Annotation of embedaddon/php/ext/standard/tests/file/disk_free_space_error-win32.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 Valid only for 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, " 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(): The system cannot find the path specified.
59: in %s on line %d
60: bool(false)
61:
62: Warning: diskfreespace(): The system cannot find the path specified.
63: in %s on line %d
64: bool(false)
65:
66: Warning: disk_free_space(): The directory name is invalid.
67: in %s on line %d
68: bool(false)
69:
70: Warning: diskfreespace(): The directory name is invalid.
71: in %s on line %d
72: bool(false)
73:
74: -- Done --
75:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>