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

1.1       misho       1: --TEST--
                      2: Test disk_free_space and its alias diskfreespace() functions : error conditions.
                      3: --SKIPIF--
                      4: <?php
                      5: if(substr(PHP_OS, 0, 3) == 'WIN')
                      6:   die("skip Not valid on Windows");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: /*
                     11:  *  Prototype: float disk_free_space( string directory )
                     12:  *  Description: Given a string containing a directory, this function will 
                     13:  *               return the number of bytes available on the corresponding 
                     14:  *               filesystem or disk partition
                     15:  */
                     16: 
                     17: echo "*** Testing error conditions ***\n";
                     18: $file_path = dirname(__FILE__);
                     19: var_dump( disk_free_space() ); // Zero Arguments
                     20: var_dump( diskfreespace() );
                     21: 
                     22: var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
                     23: var_dump( diskfreespace( $file_path, "extra argument") );
                     24: 
                     25: 
                     26: var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
                     27: var_dump( diskfreespace( $file_path."/dir1" ));
                     28: 
                     29: $fh = fopen( $file_path."/disk_free_space.tmp", "w" );
                     30: fwrite( $fh, (binary)" Garbage data for the temporary file" );
                     31: var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
                     32: var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
                     33: fclose($fh);
                     34: 
                     35: echo"\n-- Done --";
                     36: ?>
                     37: --CLEAN--
                     38: <?php
                     39: $file_path = dirname(__FILE__);
                     40: unlink($file_path."/disk_free_space.tmp");
                     41: 
                     42: ?>
                     43: --EXPECTF--
                     44: *** Testing error conditions ***
                     45: 
                     46: Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
                     47: NULL
                     48: 
                     49: Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d
                     50: NULL
                     51: 
                     52: Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d
                     53: NULL
                     54: 
                     55: Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
                     56: NULL
                     57: 
                     58: Warning: disk_free_space(): No such file or directory in %s on line %d
                     59: bool(false)
                     60: 
                     61: Warning: diskfreespace(): No such file or directory in %s on line %d
                     62: bool(false)
                     63: float(%d)
                     64: float(%d)
                     65: 
                     66: -- Done --
                     67: 

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