1--TEST--
2Test disk_free_space and its alias diskfreespace() functions : 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
10echo "*** Testing error conditions ***\n";
11$file_path = __DIR__;
12
13var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
14var_dump( diskfreespace( $file_path."/dir1" ));
15
16$fh = fopen( $file_path."/disk_free_space.tmp", "w" );
17fwrite( $fh, " Garbage data for the temporary file" );
18var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
19var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
20fclose($fh);
21
22echo"\n-- Done --";
23?>
24--CLEAN--
25<?php
26$file_path = __DIR__;
27unlink($file_path."/disk_free_space.tmp");
28
29?>
30--EXPECTF--
31*** Testing error conditions ***
32
33Warning: disk_free_space(): No such file or directory in %s on line %d
34bool(false)
35
36Warning: diskfreespace(): No such file or directory in %s on line %d
37bool(false)
38float(%f)
39float(%f)
40
41-- Done --
42