Annotation of embedaddon/php/ext/standard/tests/file/disk_free_space_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test disk_free_space and its alias diskfreespace() functions : basic functionality
                      3: --INI--
                      4: memory_limit=32M
                      5: --FILE--
                      6: <?php
                      7: /*
                      8:  *  Prototype: float disk_free_space( string directory )
                      9:  *  Description: Given a string containing a directory, this function 
                     10:  *               will return the number of bytes available on the corresponding 
                     11:  *               filesystem or disk partition
                     12:  */
                     13: 
                     14: $file_path = dirname(__FILE__);
                     15: 
                     16: echo "*** Testing with existing directory ***\n";
                     17: var_dump( disk_free_space($file_path) ); 
                     18: var_dump( diskfreespace($file_path) ); 
                     19: 
                     20: echo "*** Testing with newly created directory ***\n";
                     21: $dir = "/disk_free_space";
                     22: mkdir($file_path.$dir);
                     23: echo" \n Free Space before writing to a file\n";
                     24: $space1 =  disk_free_space($file_path.$dir); 
                     25: var_dump( $space1 ); 
                     26: 
                     27: $fh = fopen($file_path.$dir."/disk_free_space.tmp", "a");
                     28: $data = str_repeat("x", 4096);
                     29: fwrite($fh, (binary)$data);
                     30: fclose($fh);
                     31: 
                     32: echo "\n Free Space after writing to a file\n";
                     33: $space2 =  disk_free_space($file_path.$dir); 
                     34: var_dump( $space2 ); 
                     35: 
                     36: if( $space1 > $space2 )
                     37:   echo "\n Free Space Value Is Correct\n";
                     38: else
                     39:   echo "\n Free Space Value Is Incorrect\n";
                     40: 
                     41: echo "*** Testing with Binary Input ***\n";
                     42: var_dump( disk_free_space(b"$file_path") ); 
                     43: 
                     44: echo"\n--- Done ---";
                     45: ?>
                     46: 
                     47: --CLEAN--
                     48: <?php
                     49: $file_path = dirname(__FILE__);
                     50: unlink($file_path."/disk_free_space/disk_free_space.tmp");
                     51: rmdir($file_path."/disk_free_space");
                     52: ?>
                     53: 
                     54: --EXPECTF--
                     55: *** Testing with existing directory ***
                     56: float(%d)
                     57: float(%d)
                     58: *** Testing with newly created directory ***
                     59:  
                     60:  Free Space before writing to a file
                     61: float(%d)
                     62: 
                     63:  Free Space after writing to a file
                     64: float(%d)
                     65: 
                     66:  Free Space Value Is Correct
                     67: *** Testing with Binary Input ***
                     68: float(%d)
                     69: 
                     70: --- Done ---

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