rezzza/time-traveler

This package is abandoned and no longer maintained. No replacement package was suggested.

Travel the time in PHP

Installs: 8 214

Dependents: 2

Suggesters: 1

Security: 0

Stars: 104

Watchers: 7

Forks: 13

Open Issues: 4

Type:standalone

v1.0.0 2014-05-19 08:01 UTC

This package is not auto-updated.

Last update: 2020-12-06 03:17:33 UTC


README

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