Class SleepEnvironmentBuilder
Builds a sleep(), usleep(), date(), time() and microtime() mock environment.
In this environment sleep() and usleep() don't sleep for real. Instead they return immediatly and increase the amount of time in the mocks for date(), time() and microtime().
Example:
namespace foo; use phpmock\environment\SleepEnvironmentBuilder; $builder = new SleepEnvironmentBuilder(); $builder->addNamespace(__NAMESPACE__) ->setTimestamp(1417011228); $environment = $builder->build(); $environment->enable(); // This won't delay the test for 10 seconds, but increase time(). sleep(10); assert(1417011228 + 10 == time()); // Now revert the effect so that sleep() and time() are not mocked anymore. $environment->disable();
Namespace: phpmock\environment
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at environment/SleepEnvironmentBuilder.php
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at environment/SleepEnvironmentBuilder.php
public
|
|
public
|
|
public
|