1--TEST--
2Test disk_total_space() function : error conditions
3--SKIPIF--
4<?php
5if(substr(PHP_OS, 0, 3) != 'WIN' )
6  die("skip Valid only for Windows");
7?>
8--CONFLICTS--
9disk_total_space
10--FILE--
11<?php
12/*
13 *  Prototype: float disk_total_space( string $directory );
14 *  Description: given a string containing a directory, this function
15 *               will return the total number of bytes on the corresponding
16 *               filesystem or disk partition
17 */
18
19echo "*** Testing error conditions ***\n";
20$file_path = __DIR__;
21var_dump( disk_total_space() ); // Zero Arguments
22
23var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
24
25
26var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
27
28$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
29fwrite( $fh, " Garbage data for the temporary file" );
30var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
31fclose($fh);
32
33echo"\n--- Done ---";
34?>
35--CLEAN--
36<?php
37$file_path = __DIR__;
38unlink($file_path."/disk_total_space.tmp");
39?>
40--EXPECTF--
41*** Testing error conditions ***
42
43Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
44NULL
45
46Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
47NULL
48
49Warning: disk_total_space(): The system cannot find the path specified.
50 in %s on line %d
51bool(false)
52
53Warning: disk_total_space(): The directory name is invalid.
54 in %s on line %d
55bool(false)
56
57--- Done ---
58