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