stat_variation6-win32.phpt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. --TEST--
  2. Test stat() functions: usage variations - changing permissions of dir/file
  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 effects on the stats of dir/file for changing permissions of dir/file */
  16. $file_path = dirname(__FILE__);
  17. require "$file_path/file.inc";
  18. /* create temp file and directory */
  19. $dirname = "$file_path/stat_variation6";
  20. mkdir($dirname); // temp dir
  21. $filename = "$file_path/stat_variation6.tmp";
  22. $file_handle = fopen($filename, "w"); // temp file
  23. fclose($file_handle);
  24. // checking stat() on file
  25. echo "\n*** Testing stat() on file with miscelleneous file permission and content ***\n";
  26. $old_stat = stat($filename);
  27. var_dump( chmod($filename, 0777) );
  28. // clear the stat
  29. clearstatcache();
  30. sleep(2);
  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(); // clear statement cache
  40. // checking stat() on directory
  41. echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n";
  42. $old_stat = stat($dirname);
  43. var_dump( chmod($dirname, 0777) );
  44. // clear the stat
  45. clearstatcache();
  46. sleep(2);
  47. $new_stat = stat($dirname);
  48. // compare self stats
  49. var_dump( compare_self_stat($old_stat) );
  50. var_dump( compare_self_stat($new_stat) );
  51. // compare the stat
  52. $affected_members = array( 10, 'ctime');
  53. var_dump( compare_stats($old_stat, $new_stat, $affected_members, "=") );
  54. // clear the stat
  55. clearstatcache(); // clear statement cache
  56. echo "\n*** Done ***";
  57. ?>
  58. --CLEAN--
  59. <?php
  60. $file_path = dirname(__FILE__);
  61. unlink("$file_path/stat_variation6.tmp");
  62. rmdir("$file_path/stat_variation6");
  63. ?>
  64. --EXPECTF--
  65. *** Testing stat() on file with miscelleneous file permission and content ***
  66. bool(true)
  67. bool(true)
  68. bool(true)
  69. bool(true)
  70. *** Testing stat() on directory with miscelleneous file permission ***
  71. bool(true)
  72. bool(true)
  73. bool(true)
  74. bool(true)
  75. *** Done ***