1--TEST--
2Test lstat() and stat() functions: usage variations - creating file/subdir
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7    die('skip.. Not valid for Windows');
8}
9?>
10--FILE--
11<?php
12$file_path = __DIR__;
13require "$file_path/file.inc";
14
15/* test the effects on stats with creating file/subdir in a dir
16*/
17
18/* create temp file */
19mkdir("$file_path/lstat_stat_variation8/");  // temp dir
20
21// creating and deleting subdir and files in the dir
22echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
23$dirname = "$file_path/lstat_stat_variation8";
24$old_stat = stat($dirname);
25clearstatcache();
26sleep(1);
27mkdir("$dirname/lstat_stat_variation8_subdir");
28$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
29fclose($file_handle);
30$new_stat = stat($dirname);
31
32// compare self stats
33var_dump( compare_self_stat($old_stat) );
34var_dump( compare_self_stat($new_stat) );
35// compare the stat
36$affected_members = array(9, 10, 'mtime', 'ctime');
37clearstatcache();
38var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
39
40echo "\n--- Done ---";
41?>
42--CLEAN--
43<?php
44$file_path = __DIR__;
45unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp");
46rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/");
47rmdir("$file_path/lstat_stat_variation8");
48?>
49--EXPECT--
50*** Testing stat() on dir after subdir and file is created in it ***
51bool(true)
52bool(true)
53bool(true)
54
55--- Done ---
56