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/disk_free_space_variation.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/disk_free_space_variation.phpt')
-rw-r--r-- | ext/standard/tests/file/disk_free_space_variation.phpt | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt new file mode 100644 index 0000000..adb1aca --- /dev/null +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test disk_free_space and its alias diskfreespace() functions : Usage Variations +--FILE-- +<?php +/* + * Prototype: float disk_free_space( string directory ) + * Description: Given a string containing a directory, this function + * will return the number of bytes available on the corresponding + * filesystem or disk partition + */ + +$file_path = dirname(__FILE__); + +echo "*** Testing with a directory ***\n"; +var_dump( disk_free_space($file_path."/..") ); +var_dump( diskfreespace($file_path."/..") ); + +echo "\nTesting for the return type ***\n"; +$return_value = disk_free_space($file_path); +var_dump( is_float($return_value) ); + +echo "\n*** Testing with different directory combinations ***"; +$dir = "/disk_free_space"; +mkdir($file_path.$dir); + +$dirs_arr = array( + ".", + $file_path.$dir, + $file_path."/.".$dir, + + /* Testing a file trailing slash */ + $file_path."".$dir."/", + $file_path."/.".$dir."/", + + /* Testing file with double trailing slashes */ + $file_path.$dir."//", + $file_path."/.".$dir."//", + $file_path."/./".$dir."//", + + /* Testing Binary safe */ + $file_path.$dir.chr(0), + $file_path."/.".$dir.chr(0), + ".".chr(0).$file_path.$dir, + ".".chr(0).$file_path.$dir.chr(0) +); + +$count = 1; +/* loop through to test each element the above array */ +foreach($dirs_arr as $dir1) { + echo "\n-- Iteration $count --\n"; + var_dump( disk_free_space( $dir1 ) ); + var_dump( diskfreespace( $dir1 ) ); + $count++; +} + +echo"\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir($file_path."/disk_free_space"); +?> + + +--EXPECTF-- +*** Testing with a directory *** +float(%d) +float(%d) + +Testing for the return type *** +bool(true) + +*** Testing with different directory combinations *** +-- Iteration 1 -- +float(%d) +float(%d) + +-- Iteration 2 -- +float(%d) +float(%d) + +-- Iteration 3 -- +float(%d) +float(%d) + +-- Iteration 4 -- +float(%d) +float(%d) + +-- Iteration 5 -- +float(%d) +float(%d) + +-- Iteration 6 -- +float(%d) +float(%d) + +-- Iteration 7 -- +float(%d) +float(%d) + +-- Iteration 8 -- +float(%d) +float(%d) + +-- Iteration 9 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d +NULL + +--- Done --- |