1--TEST--
2Test lstat() and stat() functions: usage variations - effects of rename() on dir
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip.. Not valid for Windows');
7}
8?>
9--FILE--
10<?php
11/* Prototype: array lstat ( string $filename );
12   Description: Gives information about a file or symbolic link
13
14   Prototype: array stat ( string $filename );
15   Description: Gives information about a file
16*/
17
18/* test the effects of rename() on stats of dir */
19
20$file_path = dirname(__FILE__);
21require("file.inc");
22
23/* create temp directory */
24mkdir("$file_path/lstat_stat_variation1/");  // temp dir
25
26// renaming a directory and check stat
27echo "*** Testing stat() for directory after being renamed ***\n";
28$old_dirname = "$file_path/lstat_stat_variation1";
29$new_dirname = "$file_path/lstat_stat_variation1a";
30$old_stat = stat($old_dirname);
31clearstatcache();
32var_dump( rename($old_dirname, $new_dirname) );
33$new_stat = stat($new_dirname);
34
35// compare self stats
36var_dump( compare_self_stat($old_stat) );
37var_dump( compare_self_stat($new_stat) );
38
39// compare the two stats - all except ctime
40$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
41                       "dev", "ino", "mode", "nlink", "uid", "gid",
42                       "rdev", "size", "atime", "mtime", "blksize", "blocks");
43var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
44// clear the cache
45clearstatcache();
46
47echo "\n--- Done ---";
48?>
49
50--CLEAN--
51<?php
52$file_path = dirname(__FILE__);
53rmdir("$file_path/lstat_stat_variation1a");
54?>
55--EXPECTF--
56*** Testing stat() for directory after being renamed ***
57bool(true)
58bool(true)
59bool(true)
60bool(true)
61
62--- Done ---
63