Annotation of embedaddon/php/ext/standard/tests/file/disk_total_space_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test disk_total_space() function : 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_total_space( string $directory );
12: * Description: given a string containing a directory, this function
13: * will return the total number of bytes 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_total_space() ); // Zero Arguments
20:
21: var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
22:
23:
24: var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
25:
26: $fh = fopen( $file_path."/disk_total_space.tmp", "w" );
27: fwrite( $fh, (binary)" Garbage data for the temporary file" );
28: var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
29: fclose($fh);
30:
31: echo"\n--- Done ---";
32: ?>
33: --CLEAN--
34: <?php
35: $file_path = dirname(__FILE__);
36: unlink($file_path."/disk_total_space.tmp");
37: ?>
38: --EXPECTF--
39: *** Testing error conditions ***
40:
41: Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
42: NULL
43:
44: Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
45: NULL
46:
47: Warning: disk_total_space(): No such file or directory in %s on line %d
48: bool(false)
49: float(%d)
50:
51: --- Done ---
52:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>