1--TEST--
2Test disk_total_space() function : error conditions
3--SKIPIF--
4<?php
5if(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
17echo "*** Testing error conditions ***\n";
18$file_path = dirname(__FILE__);
19var_dump( disk_total_space() ); // Zero Arguments
20
21var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
22
23
24var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
25
26$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
27fwrite( $fh, (binary)" Garbage data for the temporary file" );
28var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
29fclose($fh);
30
31echo"\n--- Done ---";
32?>
33--CLEAN--
34<?php
35$file_path = dirname(__FILE__);
36unlink($file_path."/disk_total_space.tmp");
37?>
38--EXPECTF--
39*** Testing error conditions ***
40
41Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
42NULL
43
44Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
45NULL
46
47Warning: disk_total_space(): No such file or directory in %s on line %d
48bool(false)
49float(%d)
50
51--- Done ---
52
53