005_basic.phpt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality
  3. --FILE--
  4. <?php
  5. /*
  6. Prototype: int fileatime ( string $filename );
  7. Description: Returns the time the file was last accessed, or FALSE
  8. in case of an error. The time is returned as a Unix timestamp.
  9. Prototype: int filemtime ( string $filename );
  10. Description: Returns the time the file was last modified, or FALSE
  11. in case of an error.
  12. Prototype: int filectime ( string $filename );
  13. Description: Returns the time the file was last changed, or FALSE
  14. in case of an error. The time is returned as a Unix timestamp.
  15. Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
  16. Description: Attempts to set the access and modification times of the file
  17. named in the filename parameter to the value given in time.
  18. */
  19. echo "*** Testing the basic functionality with file ***\n";
  20. print( @date('Y:M:D:H:i:s', fileatime(__FILE__)) )."\n";
  21. print( @date('Y:M:D:H:i:s', filemtime(__FILE__)) )."\n";
  22. print( @date('Y:M:D:H:i:s', filectime(__FILE__)) )."\n";
  23. print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic.tmp")) )."\n";
  24. echo "*** Testing the basic functionality with dir ***\n";
  25. print( @date('Y:M:D:H:i:s', fileatime(".")) )."\n";
  26. print( @date('Y:M:D:H:i:s', filemtime(".")) )."\n";
  27. print( @date('Y:M:D:H:i:s', filectime(".")) )."\n";
  28. print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic")) )."\n";
  29. echo "\n*** Done ***\n";
  30. ?>
  31. --CLEAN--
  32. <?php
  33. unlink(dirname(__FILE__)."/005_basic.tmp");
  34. unlink(dirname(__FILE__)."/005_basic");
  35. ?>
  36. --EXPECTF--
  37. *** Testing the basic functionality with file ***
  38. %d:%s:%s:%d:%d:%d
  39. %d:%s:%s:%d:%d:%d
  40. %d:%s:%s:%d:%d:%d
  41. %d:%s:%s:%d:%d:%d
  42. *** Testing the basic functionality with dir ***
  43. %d:%s:%s:%d:%d:%d
  44. %d:%s:%s:%d:%d:%d
  45. %d:%s:%s:%d:%d:%d
  46. %d:%s:%s:%d:%d:%d
  47. *** Done ***