Return to lstat_stat_variation16.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test lstat() and stat() functions: usage variations - effects changing permissions of file 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: --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 with changing permissions of file */ 20: 21: $file_path = dirname(__FILE__); 22: require "$file_path/file.inc"; 23: 24: $filename = "$file_path/lstat_stat_variation16.tmp"; 25: $fp = fopen($filename, "w"); // temp file 26: fclose($fp); 27: 28: // checking stat() on file after changing its permission 29: echo "*** Testing lstat() on a file after changing its access permission ***\n"; 30: $old_stat = stat($filename); 31: sleep(2); 32: var_dump( chmod($filename, 0777) ); 33: // clear the stat 34: clearstatcache(); 35: $new_stat = stat($filename); 36: // compare self stats 37: var_dump( compare_self_stat($old_stat) ); 38: var_dump( compare_self_stat($new_stat) ); 39: // compare the stat 40: $affected_members = array(10, 'ctime'); 41: var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); 42: 43: echo "\n--- Done ---"; 44: ?> 45: 46: --CLEAN-- 47: <?php 48: $file_path = dirname(__FILE__); 49: unlink("$file_path/lstat_stat_variation16.tmp"); 50: ?> 51: --EXPECTF-- 52: *** Testing lstat() on a file after changing its access permission *** 53: bool(true) 54: bool(true) 55: bool(true) 56: bool(true) 57: 58: --- Done ---