1--TEST--
2Test stat() functions: usage variations - effects of writing to file
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6    die('skip.. only for Windows');
7}
8?>
9--FILE--
10<?php
11
12/* test the effects of writing to a file on the stats of the file */
13
14
15$file_path = __DIR__;
16require "$file_path/file.inc";
17
18
19$filename = "$file_path/stat_variation2.tmp";
20$file_handle = fopen($filename, "w");  // temp file
21fclose($file_handle);
22
23
24echo "*** Testing stat(): writing to a file ***\n";
25
26// writing to an empty file
27echo "-- Testing stat() on file after data is written in it --\n";
28$old_stat = stat($filename);
29clearstatcache();
30sleep(1);
31$file_handle = fopen($filename, "w");  // temp file
32fwrite($file_handle, "Hello World");
33fclose($file_handle);
34$new_stat = stat($filename);
35
36// compare self stats
37var_dump( compare_self_stat($old_stat) );
38var_dump( compare_self_stat($new_stat) );
39// compare the stats
40$comp_arr = array(7, 'size');
41var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<"));
42clearstatcache();
43
44echo "\n*** Done ***";
45?>
46--CLEAN--
47<?php
48$file_path = __DIR__;
49unlink("$file_path/stat_variation2.tmp");
50?>
51--EXPECT--
52*** Testing stat(): writing to a file ***
53-- Testing stat() on file after data is written in it --
54bool(true)
55bool(true)
56bool(true)
57
58*** Done ***
59