Annotation of embedaddon/php/ext/standard/tests/file/lstat_stat_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test lstat() and stat() functions: usage variations - effects of rename() on dir
                      3: --SKIPIF--
                      4: <?php
                      5: if (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__);
                     21: require("file.inc");
                     22: 
                     23: /* create temp directory */
                     24: mkdir("$file_path/lstat_stat_variation1/");  // temp dir
                     25: 
                     26: // renaming a directory and check stat
                     27: echo "*** 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);
                     31: clearstatcache();
                     32: var_dump( rename($old_dirname, $new_dirname) );
                     33: $new_stat = stat($new_dirname);
                     34: 
                     35: // compare self stats
                     36: var_dump( compare_self_stat($old_stat) );
                     37: var_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");
                     43: var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
                     44: // clear the cache
                     45: clearstatcache();
                     46: 
                     47: echo "\n--- Done ---";
                     48: ?>
                     49: 
                     50: --CLEAN--
                     51: <?php
                     52: $file_path = dirname(__FILE__);
                     53: rmdir("$file_path/lstat_stat_variation1a");
                     54: ?>
                     55: --EXPECTF--
                     56: *** Testing stat() for directory after being renamed ***
                     57: bool(true)
                     58: bool(true)
                     59: bool(true)
                     60: bool(true)
                     61: 
                     62: --- Done ---

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>