005_variation2.phpt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 Non Windows Systems');
  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 touch ***\n";
  27. $b = touch(false);
  28. $c = touch('');
  29. $d = touch(' ');
  30. $e = touch('|');
  31. var_dump($a);
  32. var_dump($b);
  33. var_dump($c);
  34. var_dump($d);
  35. var_dump($e);
  36. echo "\n*** testing file info ***";
  37. stat_fn(false);
  38. stat_fn('');
  39. stat_fn(' ');
  40. stat_fn('|');
  41. var_dump(unlink(' '));
  42. var_dump(unlink('|'));
  43. echo "Done";
  44. ?>
  45. --EXPECTF--
  46. *** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
  47. *** testing touch ***
  48. Warning: Undefined variable $a in %s on line %d
  49. NULL
  50. bool(false)
  51. bool(false)
  52. bool(true)
  53. bool(true)
  54. *** testing file info ***
  55. -- File '' --
  56. -- File access time is =>
  57. -- File modification time is =>
  58. -- inode change time is =>
  59. -- File '' --
  60. -- File access time is =>
  61. -- File modification time is =>
  62. -- inode change time is =>
  63. -- File ' ' --
  64. -- File access time is => %d
  65. -- File modification time is => %d
  66. -- inode change time is => %d
  67. -- File '|' --
  68. -- File access time is => %d
  69. -- File modification time is => %d
  70. -- inode change time is => %d
  71. bool(true)
  72. bool(true)
  73. Done