1--TEST-- 2Test lstat() and stat() functions: usage variations - effects of touch() on file 3--SKIPIF-- 4<?php 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6?> 7--FILE-- 8<?php 9/* test the effects of touch() on stats of file */ 10 11$file_path = __DIR__; 12require "$file_path/file.inc"; 13 14 15/* create temp file */ 16 17$file_name = "$file_path/lstat_stat_variation4.tmp"; 18$fp = fopen($file_name, "w"); // temp file 19fclose($fp); 20 21// touch a file check stat, there should be difference in atime 22echo "*** Testing stat() for file after using touch() on the file ***\n"; 23$old_stat = stat($file_name); 24// clear the cache 25clearstatcache(); 26sleep(1); 27var_dump( touch($file_name) ); 28$new_stat = stat($file_name); 29 30// compare self stats 31var_dump( compare_self_stat($old_stat) ); 32var_dump( compare_self_stat($new_stat) ); 33 34// compare the stat 35$affected_members = array(8, 'atime'); 36var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); 37// clear the cache 38clearstatcache(); 39 40echo "\n--- Done ---"; 41?> 42--CLEAN-- 43<?php 44$file_path = __DIR__; 45unlink("$file_path/lstat_stat_variation4.tmp"); 46?> 47--EXPECT-- 48*** Testing stat() for file after using touch() on the file *** 49bool(true) 50bool(true) 51bool(true) 52bool(true) 53 54--- Done --- 55