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