stat_variation5-win32.phpt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --TEST--
  2. Test stat() functions: usage variations - file opened in read/write mode
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die('skip.. only for Windows');
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /*
  12. * Prototype: array stat ( string $filename );
  13. * Description: Gives information about a file
  14. */
  15. /* test the stats of file opened in write mode and then same in read mode */
  16. $file_path = dirname(__FILE__);
  17. require "$file_path/file.inc";
  18. $file_handle = fopen("$file_path/stat_variation5.tmp", "w"); // temp file
  19. fclose($file_handle);
  20. echo "\n*** Testing stat(): on a file with read/write permission ***\n";
  21. $filename = "$file_path/stat_variation5.tmp";
  22. $file_handle = fopen($filename, "w"); // create file
  23. fclose($file_handle);
  24. $old_stat = stat($filename);
  25. // clear the stat
  26. clearstatcache();
  27. sleep(2);
  28. // opening file again in read mode
  29. $file_handle = fopen($filename, "r"); // read file
  30. fclose($file_handle);
  31. $new_stat = stat($filename);
  32. // compare self stats
  33. var_dump( compare_self_stat($old_stat) );
  34. var_dump( compare_self_stat($new_stat) );
  35. // compare the stat
  36. $affected_members = array(10, 'ctime');
  37. var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
  38. // clear the stat
  39. clearstatcache();
  40. echo "\n*** Done ***";
  41. ?>
  42. --CLEAN--
  43. <?php
  44. $file_path = dirname(__FILE__);
  45. unlink("$file_path/stat_variation5.tmp");
  46. ?>
  47. --EXPECTF--
  48. *** Testing stat(): on a file with read/write permission ***
  49. bool(true)
  50. bool(true)
  51. bool(true)
  52. *** Done ***