public setMicrotimeAsFloat ( float $timestamp ) | ||
$timestamp | float | The timestamp as float. |
public function setMicrotimeAsFloat($timestamp)
{
if (!is_numeric($timestamp)) {
throw new \InvalidArgumentException("Timestamp should be numeric");
}
$converter = new MicrotimeConverter();
$this->timestamp = $converter->convertFloatToString($timestamp);
}
/** * Tests getCallable() * * @test */ public function testGetCallable() { $function = new FixedMicrotimeFunction(); $function->setMicrotimeAsFloat(1.00000001); $builder = new MockBuilder(); $builder->setNamespace(__NAMESPACE__)->setName("microtime")->setFunctionProvider($function); $mock = $builder->build(); $mock->enable(); $this->assertEquals("0.00000001 1", microtime()); $this->assertEquals(1.00000001, microtime(true)); $mock->disable(); }