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

1.1       misho       1: --TEST--
                      2: Testing disk_total_space() functions : Usage Variations.
                      3: --FILE--
                      4: <?php
                      5: /*
                      6:  *  Prototype: float disk_total_space( string directory )
                      7:  *  Description: given a string containing a directory, this function 
                      8:  *               will return the total number of bytes 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_total_space($file_path."/..") ); 
                     16: 
                     17: echo "\nTesting for the return type ***\n";
                     18: $return_value = disk_total_space($file_path); 
                     19: var_dump( is_float($return_value) );
                     20: 
                     21: echo "\n*** Testing with different directory combinations ***";
                     22: $dir = "/disk_total_space";
                     23: 
                     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: 
                     48: $count = 1;
                     49: /* loop through to test each element the above array */
                     50: foreach($dirs_arr as $dir1) {
                     51:   echo "\n-- Iteration $count --\n";
                     52:   var_dump( disk_total_space( $dir1 ) );
                     53:   $count++;
                     54: }
                     55: 
                     56: echo "*** Testing with Binary Input ***\n";
                     57: var_dump( disk_total_space(b"$file_path") ); 
                     58: 
                     59: echo"\n--- Done ---";
                     60: ?>
                     61: 
                     62: --CLEAN--
                     63: <?php
                     64: $file_path = dirname(__FILE__);
                     65: rmdir($file_path."/disk_total_space");
                     66: ?>
                     67: 
                     68: 
                     69: --EXPECTF--
                     70: *** Testing with a directory ***
                     71: float(%d)
                     72: 
                     73: Testing for the return type ***
                     74: bool(true)
                     75: 
                     76: *** Testing with different directory combinations ***
                     77: -- Iteration 1 --
                     78: float(%d)
                     79: 
                     80: -- Iteration 2 --
                     81: float(%d)
                     82: 
                     83: -- Iteration 3 --
                     84: float(%d)
                     85: 
                     86: -- Iteration 4 --
                     87: float(%d)
                     88: 
                     89: -- Iteration 5 --
                     90: float(%d)
                     91: 
                     92: -- Iteration 6 --
                     93: float(%d)
                     94: 
                     95: -- Iteration 7 --
                     96: float(%d)
                     97: 
                     98: -- Iteration 8 --
                     99: float(%d)
                    100: 
                    101: -- Iteration 9 --
1.1.1.2 ! misho     102: 
        !           103: Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           104: NULL
1.1       misho     105: 
                    106: -- Iteration 10 --
1.1.1.2 ! misho     107: 
        !           108: Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           109: NULL
1.1       misho     110: 
                    111: -- Iteration 11 --
1.1.1.2 ! misho     112: 
        !           113: Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           114: NULL
1.1       misho     115: 
                    116: -- Iteration 12 --
1.1.1.2 ! misho     117: 
        !           118: Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
        !           119: NULL
1.1       misho     120: *** Testing with Binary Input ***
                    121: float(%d)
                    122: 
                    123: --- Done ---

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