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

1.1     ! misho       1: --TEST--
        !             2: Test lstat() and stat() functions: usage variations - effects of touch() on dir
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
        !             6: if (substr(PHP_OS, 0, 3) == 'WIN') {
        !             7:     die('skip.. Not valid for Windows');
        !             8: }
        !             9: ?>
        !            10: ?>
        !            11: --FILE--
        !            12: <?php
        !            13: /* Prototype: array lstat ( string $filename );
        !            14:    Description: Gives information about a file or symbolic link
        !            15: 
        !            16:    Prototype: array stat ( string $filename );
        !            17:    Description: Gives information about a file
        !            18: */
        !            19: 
        !            20: /* test the effects of touch() on stats of dir */
        !            21: 
        !            22: $file_path = dirname(__FILE__);
        !            23: require "$file_path/file.inc";
        !            24: 
        !            25: 
        !            26: /* create temp directory */
        !            27: 
        !            28: $dir_name = "$file_path/lstat_stat_variation5";
        !            29: @rmdir($dir_name);  //ensure that dir doesn't exists 
        !            30: mkdir($dir_name);  // temp dir
        !            31: 
        !            32: // touch a directory and check stat, there should be difference in atime
        !            33: echo "*** Testing stat() for directory after using touch() on the directory ***\n";
        !            34: $old_stat = stat($dir_name);
        !            35: // clear the cache
        !            36: clearstatcache();
        !            37: sleep(2);
        !            38: var_dump( touch($dir_name) );
        !            39: $new_stat = stat($dir_name);
        !            40: 
        !            41: // compare self stats
        !            42: var_dump( compare_self_stat($old_stat) );
        !            43: var_dump( compare_self_stat($new_stat) );
        !            44: 
        !            45: // compare the stat
        !            46: $affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime');
        !            47: var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
        !            48: // clear the cache
        !            49: clearstatcache();
        !            50: 
        !            51: echo "\n--- Done ---";
        !            52: ?>
        !            53: 
        !            54: --CLEAN--
        !            55: <?php
        !            56: $file_path = dirname(__FILE__);
        !            57: rmdir("$file_path/lstat_stat_variation5");
        !            58: ?>
        !            59: --EXPECTF--
        !            60: *** Testing stat() for directory after using touch() on the directory ***
        !            61: bool(true)
        !            62: bool(true)
        !            63: bool(true)
        !            64: bool(true)
        !            65: 
        !            66: --- Done ---

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