Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.
/ TimeTraveler Public archive

Time traveling php library (pretty similar to ruby timecop)

Notifications You must be signed in to change notification settings

rezzza/TimeTraveler

Repository files navigation

TimeTraveler

Latest Stable Version Build Status Scrutinizer Code Quality

          _
         /-\
    _____|#|_____
   |_____________|
  |_______________|
|||_Time_Traveler_|||
 | |¯|¯|¯|||¯|¯|¯| |
 | |-|-|-|||-|-|-| |
 | |_|_|_|||_|_|_| |
 | ||~~~| | |¯¯¯|| |
 | ||~~~|!|!| O || |
 | ||~~~| |.|___|| |
 | ||¯¯¯| | |¯¯¯|| |
 | ||   | | |   || |
 | ||___| | |___|| |
 | ||¯¯¯| | |¯¯¯|| |
 | ||   | | |   || |
 | ||___| | |___|| |
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
 ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Mock the time system in PHP using AOP-PHP. You can now travel the time on your application easily !

Methods supported

  • DateTime object.
  • date_create
  • date
  • gettimeofday
  • gmdate
  • microtime
  • strtotime
  • time

Usage

\Rezzza\TimeTraveler::enable();
\Rezzza\TimeTraveler::moveTo('2011-06-10 11:00:00');

var_dump(new \DateTime());           // 2011-06-10 11:00:00
var_dump(new \DateTime('+2 hours')); // 2011-06-10 13:00:00
var_dump(time());
var_dump(microtime());
var_dump(microtime(true));

\Rezzza\TimeTraveler::comeBack();

Launch tests

composer install --dev
bin/atoum

About

Time traveling php library (pretty similar to ruby timecop)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages