1--TEST--
2Test lstat() and stat() functions: usage variations - effects of rename() on dir
3--FILE--
4<?php
5/* test the effects of rename() on stats of dir */
6
7$file_path = __DIR__;
8require("file.inc");
9
10/* create temp directory */
11mkdir("$file_path/lstat_stat_variation1/");  // temp dir
12
13// renaming a directory and check stat
14echo "*** Testing stat() for directory after being renamed ***\n";
15$old_dirname = "$file_path/lstat_stat_variation1";
16$new_dirname = "$file_path/lstat_stat_variation1a";
17$old_stat = stat($old_dirname);
18clearstatcache();
19var_dump( rename($old_dirname, $new_dirname) );
20$new_stat = stat($new_dirname);
21
22// compare self stats
23var_dump( compare_self_stat($old_stat) );
24var_dump( compare_self_stat($new_stat) );
25
26// compare the two stats - all except ctime
27$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
28                       "dev", "ino", "mode", "nlink", "uid", "gid",
29                       "rdev", "size", "atime", "mtime", "blksize", "blocks");
30var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
31// clear the cache
32clearstatcache();
33
34echo "\n--- Done ---";
35?>
36--CLEAN--
37<?php
38$file_path = __DIR__;
39rmdir("$file_path/lstat_stat_variation1a");
40?>
41--EXPECT--
42*** Testing stat() for directory after being renamed ***
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47
48--- Done ---
49