diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/file/glob_error.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/file/glob_error.phpt')
-rw-r--r-- | ext/standard/tests/file/glob_error.phpt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ext/standard/tests/file/glob_error.phpt b/ext/standard/tests/file/glob_error.phpt new file mode 100644 index 0000000..546b40d --- /dev/null +++ b/ext/standard/tests/file/glob_error.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test glob() function: error conditions +--FILE-- +<?php +/* Prototype: array glob ( string $pattern [, int $flags] ); + Description: Find pathnames matching a pattern +*/ + +$file_path = dirname(__FILE__); + +// temp dir created +mkdir("$file_path/glob_error"); +// temp file created +$fp = fopen("$file_path/glob_error/wonder12345", "w"); +fclose($fp); + +echo "*** Testing glob() : error conditions ***\n"; + +echo "-- Testing glob() with unexpected no. of arguments --\n"; +var_dump( glob() ); // args < expected +var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", GLOB_ERR, 3) ); // args > expected + +echo "\n-- Testing glob() with invalid arguments --\n"; +var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", '') ); +var_dump( glob(dirname(__FILE__)."/glob_error/wonder12345", "string") ); + +echo "Done\n"; +?> +--CLEAN-- +<?php +// temp file deleted +unlink(dirname(__FILE__)."/glob_error/wonder12345"); +// temp dir deleted +rmdir(dirname(__FILE__)."/glob_error"); +?> +--EXPECTF-- +*** Testing glob() : error conditions *** +-- Testing glob() with unexpected no. of arguments -- + +Warning: glob() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: glob() expects at most 2 parameters, 3 given in %s on line %d +NULL + +-- Testing glob() with invalid arguments -- + +Warning: glob() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: glob() expects parameter 2 to be long, string given in %s on line %d +NULL +Done |