public function testBlockDoesNotBlockIfEmpty() { $clock = new Clock($this->getPulseMock()); $timers = $this->getTimersMock(); $timers->expects($this->once())->method('isEmpty')->will($this->returnValue(true)); $clock->setTimers($timers); $start = microtime(true); $clock->block(); $this->assertLessThan(0.001, microtime(true) - $start); }
public function testBlockWithoutTimerIsNotBlocking() { $clock = new Clock(new Pulse()); $start = microtime(true); $clock->block(); $duration = microtime(true) - $start; $this->assertGreaterThan(0, $duration); $this->assertLessThan(0.001, $duration); }