1--TEST--
2Test lstat() and stat() functions: usage variations - effects of touch() on dir
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?>
11--FILE--
12<?php
13/* Prototype: array lstat ( string $filename );
14   Description: Gives information about a file or symbolic link
15
16   Prototype: array stat ( string $filename );
17   Description: Gives information about a file
18*/
19
20/* test the effects of touch() on stats of dir */
21
22$file_path = dirname(__FILE__);
23require "$file_path/file.inc";
24
25
26/* create temp directory */
27
28$dir_name = "$file_path/lstat_stat_variation5";
29@rmdir($dir_name);  //ensure that dir doesn't exists
30mkdir($dir_name);  // temp dir
31
32// touch a directory and check stat, there should be difference in atime
33echo "*** Testing stat() for directory after using touch() on the directory ***\n";
34$old_stat = stat($dir_name);
35// clear the cache
36clearstatcache();
37sleep(2);
38var_dump( touch($dir_name) );
39$new_stat = stat($dir_name);
40
41// compare self stats
42var_dump( compare_self_stat($old_stat) );
43var_dump( compare_self_stat($new_stat) );
44
45// compare the stat
46$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime');
47var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
48// clear the cache
49clearstatcache();
50
51echo "\n--- Done ---";
52?>
53--CLEAN--
54<?php
55$file_path = dirname(__FILE__);
56rmdir("$file_path/lstat_stat_variation5");
57?>
58--EXPECT--
59*** Testing stat() for directory after using touch() on the directory ***
60bool(true)
61bool(true)
62bool(true)
63bool(true)
64
65--- Done ---
66