Return to lstat_stat_variation11.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 - effect of is_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: $file_path = dirname(__FILE__); 20: require "$file_path/file.inc"; 21: 22: /* test the effects of is_file() on stats of a file */ 23: 24: /* create temp file */ 25: $filename = "$file_path/lstat_stat_variation11.tmp"; 26: $fp = fopen($filename, "w"); // temp file 27: fclose($fp); 28: 29: // is_file() on a file 30: echo "*** Testing stat() on a file after using is_file() on it ***\n"; 31: $old_stat = stat($filename); 32: // clear the stat 33: clearstatcache(); 34: sleep(2); 35: var_dump( is_file($filename) ); 36: $new_stat = stat($filename); 37: // compare self stats 38: var_dump( compare_self_stat($old_stat) ); 39: var_dump( compare_self_stat($new_stat) ); 40: // compare the stat 41: var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); 42: // clear the stat 43: clearstatcache(); 44: 45: echo "\n--- Done ---"; 46: ?> 47: 48: --CLEAN-- 49: <?php 50: $file_path = dirname(__FILE__); 51: unlink("$file_path/lstat_stat_variation11.tmp"); 52: ?> 53: --EXPECTF-- 54: *** Testing stat() on a file after using is_file() on it *** 55: bool(true) 56: bool(true) 57: bool(true) 58: bool(true) 59: 60: --- Done ---