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