Annotation of embedaddon/php/ext/standard/tests/file/lstat_stat_variation3.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test lstat() and stat() functions: usage variations - effects of rename() on link
        !             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 link */
        !            19: 
        !            20: $file_path = dirname(__FILE__);
        !            21: require "$file_path/file.inc";
        !            22: 
        !            23: /* create temp file & link */
        !            24: $fp = fopen("$file_path/lstat_stat_variation3.tmp", "w");  // temp file
        !            25: fclose($fp);
        !            26: 
        !            27: // temp link
        !            28: symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp");
        !            29: 
        !            30: // renaming a link
        !            31: echo "*** Testing lstat() for link after being renamed ***\n";
        !            32: $old_linkname = "$file_path/lstat_stat_variation_link3.tmp";
        !            33: $new_linkname = "$file_path/lstat_stat_variation_link3a.tmp";
        !            34: $old_stat = lstat($old_linkname);
        !            35: clearstatcache();
        !            36: var_dump( rename($old_linkname, $new_linkname) );
        !            37: $new_stat = lstat($new_linkname);
        !            38: 
        !            39: // compare self stats
        !            40: var_dump( compare_self_stat($old_stat) );
        !            41: var_dump( compare_self_stat($new_stat) );
        !            42: 
        !            43: // compare the two stats - all except ctime
        !            44: $keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 
        !            45:                        "dev", "ino", "mode", "nlink", "uid", "gid",
        !            46:                        "rdev", "size", "atime", "mtime", "blksize", "blocks");
        !            47: var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
        !            48: ?>
        !            49: ===Done===
        !            50: --CLEAN--
        !            51: <?php
        !            52: $file_path = dirname(__FILE__);
        !            53: unlink("$file_path/lstat_stat_variation3.tmp");
        !            54: unlink("$file_path/lstat_stat_variation_link3a.tmp");
        !            55: ?>
        !            56: --EXPECT--
        !            57: *** Testing lstat() for link after being renamed ***
        !            58: bool(true)
        !            59: bool(true)
        !            60: bool(true)
        !            61: bool(true)
        !            62: ===Done===

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