Return to glob_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test glob() function: error conditions 3: --FILE-- 4: <?php 5: /* Prototype: array glob ( string $pattern [, int $flags] ); 6: Description: Find pathnames matching a pattern 7: */ 8: 9: $file_path = dirname(__FILE__); 10: 11: // temp dir created 12: mkdir("$file_path/glob_error"); 13: // temp file created 14: $fp = fopen("$file_path/glob_error/wonder12345", "w"); 15: fclose($fp); 16: 17: echo "*** Testing glob() : error conditions ***\n"; 18: 19: echo "-- Testing glob() with unexpected no. of arguments --\n"; 20: var_dump( glob() ); // args < expected 21: var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", GLOB_ERR, 3) ); // args > expected 22: 23: echo "\n-- Testing glob() with invalid arguments --\n"; 24: var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", '') ); 25: var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", "string") ); 26: 27: echo "Done\n"; 28: ?> 29: --CLEAN-- 30: <?php 31: // temp file deleted 32: unlink(dirname(__FILE__)."/glob_error/wonder12345"); 33: // temp dir deleted 34: rmdir(dirname(__FILE__)."/glob_error"); 35: ?> 36: --EXPECTF-- 37: *** Testing glob() : error conditions *** 38: -- Testing glob() with unexpected no. of arguments -- 39: 40: Warning: glob() expects at least 1 parameter, 0 given in %s on line %d 41: NULL 42: 43: Warning: glob() expects at most 2 parameters, 3 given in %s on line %d 44: NULL 45: 46: -- Testing glob() with invalid arguments -- 47: 48: Warning: glob() expects parameter 2 to be long, string given in %s on line %d 49: NULL 50: 51: Warning: glob() expects parameter 2 to be long, string given in %s on line %d 52: NULL 53: Done