Annotation of embedaddon/php/ext/standard/tests/file/disk_free_space_variation.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test disk_free_space and its alias diskfreespace() functions : Usage Variations
                      3: --FILE--
                      4: <?php
                      5: /*
                      6:  *  Prototype: float disk_free_space( string directory )
                      7:  *  Description: Given a string containing a directory, this function 
                      8:  *               will return the number of bytes available on the corresponding
                      9:  *               filesystem or disk partition
                     10:  */
                     11: 
                     12: $file_path = dirname(__FILE__);
                     13: 
                     14: echo "*** Testing with a directory ***\n";
                     15: var_dump( disk_free_space($file_path."/..") ); 
                     16: var_dump( diskfreespace($file_path."/..") ); 
                     17: 
                     18: echo "\nTesting for the return type ***\n";
                     19: $return_value = disk_free_space($file_path); 
                     20: var_dump( is_float($return_value) );
                     21: 
                     22: echo "\n*** Testing with different directory combinations ***";
                     23: $dir = "/disk_free_space";
                     24: mkdir($file_path.$dir);
                     25: 
                     26: $dirs_arr = array(
                     27:   ".",
                     28:   $file_path.$dir,
                     29:   $file_path."/.".$dir,
                     30: 
                     31:   /* Testing a file trailing slash */
                     32:   $file_path."".$dir."/",
                     33:   $file_path."/.".$dir."/",
                     34: 
                     35:   /* Testing file with double trailing slashes */
                     36:   $file_path.$dir."//",
                     37:   $file_path."/.".$dir."//",
                     38:   $file_path."/./".$dir."//",
                     39: 
                     40:   /* Testing Binary safe */
                     41:   $file_path.$dir.chr(0),
                     42:   $file_path."/.".$dir.chr(0),
                     43:   ".".chr(0).$file_path.$dir,
                     44:   ".".chr(0).$file_path.$dir.chr(0)
                     45: );
                     46: 
                     47: $count = 1;
                     48: /* loop through to test each element the above array */
                     49: foreach($dirs_arr as $dir1) {
                     50:   echo "\n-- Iteration $count --\n";
                     51:   var_dump( disk_free_space( $dir1 ) );
                     52:   var_dump( diskfreespace( $dir1 ) );
                     53:   $count++;
                     54: }
                     55: 
                     56: echo"\n--- Done ---";
                     57: ?>
                     58: 
                     59: --CLEAN--
                     60: <?php
                     61: $file_path = dirname(__FILE__);
                     62: rmdir($file_path."/disk_free_space");
                     63: ?>
                     64: 
                     65: 
                     66: --EXPECTF--
                     67: *** Testing with a directory ***
                     68: float(%d)
                     69: float(%d)
                     70: 
                     71: Testing for the return type ***
                     72: bool(true)
                     73: 
                     74: *** Testing with different directory combinations ***
                     75: -- Iteration 1 --
                     76: float(%d)
                     77: float(%d)
                     78: 
                     79: -- Iteration 2 --
                     80: float(%d)
                     81: float(%d)
                     82: 
                     83: -- Iteration 3 --
                     84: float(%d)
                     85: float(%d)
                     86: 
                     87: -- Iteration 4 --
                     88: float(%d)
                     89: float(%d)
                     90: 
                     91: -- Iteration 5 --
                     92: float(%d)
                     93: float(%d)
                     94: 
                     95: -- Iteration 6 --
                     96: float(%d)
                     97: float(%d)
                     98: 
                     99: -- Iteration 7 --
                    100: float(%d)
                    101: float(%d)
                    102: 
                    103: -- Iteration 8 --
                    104: float(%d)
                    105: float(%d)
                    106: 
                    107: -- Iteration 9 --
1.1.1.2 ! misho     108: 
        !           109: Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           110: NULL
        !           111: 
        !           112: Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
        !           113: NULL
1.1       misho     114: 
                    115: -- Iteration 10 --
1.1.1.2 ! misho     116: 
        !           117: Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           118: NULL
        !           119: 
        !           120: Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
        !           121: NULL
1.1       misho     122: 
                    123: -- Iteration 11 --
1.1.1.2 ! misho     124: 
        !           125: Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           126: NULL
        !           127: 
        !           128: Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
        !           129: NULL
1.1       misho     130: 
                    131: -- Iteration 12 --
1.1.1.2 ! misho     132: 
        !           133: Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           134: NULL
        !           135: 
        !           136: Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
        !           137: NULL
1.1       misho     138: 
                    139: --- Done ---

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>