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 Valid only for 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(): The system cannot find the path specified in %s on line %d
34bool(false)
35
36Warning: diskfreespace(): The system cannot find the path specified in %s on line %d
37bool(false)
38
39Warning: disk_free_space(): The directory name is invalid in %s on line %d
40bool(false)
41
42Warning: diskfreespace(): The directory name is invalid in %s on line %d
43bool(false)
44
45-- Done --
46