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