예제 #1
0
 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);
 }
예제 #2
0
 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);
 }