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