005_variation2-win32.phpt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. --TEST--
  2. Test fileatime(), filemtime(), filectime() & touch() functions : usage variation
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --SKIPIF--
  6. <?php
  7. if (substr(PHP_OS, 0, 3) != 'WIN') {
  8. die('skip.. only for Windows');
  9. }
  10. ?>
  11. --FILE--
  12. <?php
  13. function stat_fn( $filename ) {
  14. echo "\n-- File '$filename' --\n";
  15. echo "-- File access time is => ";
  16. echo fileatime($filename)."\n";
  17. clearstatcache();
  18. echo "-- File modification time is => ";
  19. echo filemtime($filename)."\n";
  20. clearstatcache();
  21. echo "-- inode change time is => ";
  22. echo filectime($filename)."\n";
  23. clearstatcache();
  24. }
  25. echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
  26. echo "\n*** testing file info ***";
  27. stat_fn(false);
  28. stat_fn('');
  29. stat_fn(' ');
  30. stat_fn('|');
  31. echo "\n*** testing touch ***\n";
  32. var_dump(touch(false));
  33. var_dump(touch(''));
  34. //php generates permission denied, we generate No such file or dir.
  35. var_dump(touch(' '));
  36. var_dump(touch('|'));
  37. echo "Done";
  38. ?>
  39. --EXPECTF--
  40. *** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
  41. *** testing file info ***
  42. -- File '' --
  43. -- File access time is =>
  44. -- File modification time is =>
  45. -- inode change time is =>
  46. -- File '' --
  47. -- File access time is =>
  48. -- File modification time is =>
  49. -- inode change time is =>
  50. -- File ' ' --
  51. -- File access time is =>
  52. Warning: fileatime(): stat failed for in %s on line %d
  53. -- File modification time is =>
  54. Warning: filemtime(): stat failed for in %s on line %d
  55. -- inode change time is =>
  56. Warning: filectime(): stat failed for in %s on line %d
  57. -- File '|' --
  58. -- File access time is =>
  59. Warning: fileatime(): stat failed for | in %s on line %d
  60. -- File modification time is =>
  61. Warning: filemtime(): stat failed for | in %s on line %d
  62. -- inode change time is =>
  63. Warning: filectime(): stat failed for | in %s on line %d
  64. *** testing touch ***
  65. bool(false)
  66. bool(false)
  67. Warning: touch(): %s in %s on line %d
  68. bool(false)
  69. Warning: touch(): %s in %s on line %d
  70. bool(false)
  71. Done