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

1.1       misho       1: --TEST--
                      2: Test lstat() and stat() functions: usage variations - effects changing permissions of link
                      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.. lstat() not available on Windows');
                      8: }
                      9: ?>
                     10: --FILE--
                     11: <?php
                     12: /* Prototype: array lstat ( string $filename );
                     13:    Description: Gives information about a file or symbolic link
                     14: 
                     15:    Prototype: array stat ( string $filename );
                     16:    Description: Gives information about a file
                     17: */
                     18: 
                     19: /* test the effects on stats by changing permissions of link */
                     20: 
                     21: $file_path = dirname(__FILE__);
                     22: require "$file_path/file.inc";
                     23: 
                     24: 
                     25: $filename = "$file_path/lstat_stat_variation15.tmp";
                     26: $fp = fopen($filename, "w");  // temp file
                     27: fclose($fp);
                     28: 
                     29: // temp link
                     30: $linkname = "$file_path/lstat_stat_variation15_link.tmp";
                     31: symlink($filename, $linkname);
                     32: 
                     33: // checking lstat() and stat() on links
                     34: echo "*** Testing lstat() on a link after changing its access permission ***\n";
                     35: clearstatcache();
                     36: $old_stat = lstat($linkname);
                     37: var_dump( chmod($linkname, 0777) );
                     38: // clear the stat
                     39: clearstatcache();
                     40: sleep(2);
                     41: $new_stat = lstat($linkname);
                     42: // compare self stats
                     43: var_dump( compare_self_stat($old_stat) );
                     44: var_dump( compare_self_stat($new_stat) );
                     45: // compare the stat
                     46: var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") );
                     47: 
                     48: echo "\n--- Done ---";
                     49: ?>
                     50: 
                     51: --CLEAN--
                     52: <?php
                     53: $file_path = dirname(__FILE__);
                     54: unlink("$file_path/lstat_stat_variation15_link.tmp");
                     55: unlink("$file_path/lstat_stat_variation15.tmp");
                     56: ?>
                     57: --EXPECTF--
                     58: *** Testing lstat() on a link after changing its access permission ***
                     59: bool(true)
                     60: bool(true)
                     61: bool(true)
                     62: bool(true)
                     63: 
                     64: --- Done ---

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