1--TEST--
2Test lstat() and stat() functions: usage variations - effects of rename() on file
3--FILE--
4<?php
5/* test the effects of rename() on stats of file */
6
7$file_path = __DIR__;
8require "$file_path/file.inc";
9
10/* create temp file */
11$fp = fopen("$file_path/lstat_stat_variation1.tmp", "w");  // temp file
12fclose($fp);
13
14// renaming a file and check stat
15echo "*** Testing stat() for files after being renamed ***\n";
16$file_path = __DIR__;
17$old_filename = "$file_path/lstat_stat_variation1.tmp";
18$new_filename = "$file_path/lstat_stat_variation1a.tmp";
19$old_stat = stat($old_filename);
20clearstatcache();
21var_dump( rename($old_filename, $new_filename) );
22$new_stat = stat($new_filename);
23
24// compare the self stat
25var_dump( compare_self_stat($old_stat) );
26var_dump( compare_self_stat($new_stat) );
27
28// compare the two stats
29var_dump( compare_stats($old_stat, $old_stat, $all_stat_keys) );
30// clear the cache
31clearstatcache();
32
33echo "\n--- Done ---";
34?>
35--CLEAN--
36<?php
37$file_path = __DIR__;
38unlink("$file_path/lstat_stat_variation1a.tmp");
39?>
40--EXPECT--
41*** Testing stat() for files after being renamed ***
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46
47--- Done ---
48