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/is_dir_variation3.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/is_dir_variation3.phpt')
-rw-r--r-- | ext/standard/tests/file/is_dir_variation3.phpt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt new file mode 100644 index 0000000..41826ad --- /dev/null +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test is_dir() function: usage variations - invalid arguments +--FILE-- +<?php +/* Prototype: bool is_dir ( string $dirname ); + Description: Tells whether the dirname is a directory + Returns TRUE if the dirname exists and is a directory, FALSE otherwise. +*/ + +/* Passing invalid arguments to is_dir() */ + +$dir_handle = opendir( dirname(__FILE__) ); + +echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; +$dirnames = array( + /* Invalid dirnames */ + -2.34555, + TRUE, + FALSE, + NULL, + " ", + $dir_handle, + + /* scalars */ + 0, + 1234 +); + +/* loop through to test each element the above array */ +foreach($dirnames as $dirname) { + var_dump( is_dir($dirname) ); +} +closedir($dir_handle); + +echo "\n*** Done ***"; +?> +--EXPECTF-- +*** Testing is_dir() with Invalid arguments: expected bool(false) *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d +NULL +bool(false) +bool(false) + +*** Done *** + |