import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / disk_free_space_variation.php
blobe2c64c3e265e22b1f07164880c7669d2d1de5c0b
1 <?php
2 /*
3 * Prototype: float disk_free_space( string directory )
4 * Description: Given a string containing a directory, this function
5 * will return the number of bytes available on the corresponding
6 * filesystem or disk partition
7 */
9 $file_path = dirname(__FILE__);
11 echo "*** Testing with a directory ***\n";
12 var_dump( disk_free_space($file_path."/..") );
13 var_dump( diskfreespace($file_path."/..") );
15 echo "\nTesting for the return type ***\n";
16 $return_value = disk_free_space($file_path);
17 var_dump( is_float($return_value) );
19 echo "\n*** Testing with different directory combinations ***";
20 $dir = "/disk_free_space";
21 mkdir($file_path.$dir);
23 $dirs_arr = array(
24 ".",
25 $file_path.$dir,
26 $file_path."/.".$dir,
28 /* Testing a file trailing slash */
29 $file_path."".$dir."/",
30 $file_path."/.".$dir."/",
32 /* Testing file with double trailing slashes */
33 $file_path.$dir."//",
34 $file_path."/.".$dir."//",
35 $file_path."/./".$dir."//",
37 /* Testing Binary safe */
38 $file_path.$dir.chr(0),
39 $file_path."/.".$dir.chr(0),
40 ".".chr(0).$file_path.$dir,
41 ".".chr(0).$file_path.$dir.chr(0)
44 $count = 1;
45 /* loop through to test each element the above array */
46 foreach($dirs_arr as $dir1) {
47 echo "\n-- Iteration $count --\n";
48 var_dump( disk_free_space( $dir1 ) );
49 var_dump( diskfreespace( $dir1 ) );
50 $count++;
53 echo"\n--- Done ---";
55 <?php
56 $file_path = dirname(__FILE__);
57 rmdir($file_path."/disk_free_space");