Exemple #1
0
 /**
  * @covers  FOF30\Timer\Timer::getTimeLeft
  */
 public function testGetTimeLeft()
 {
     FakeTimer::$microtime = 123456;
     $timer = new Timer(8, 33);
     FakeTimer::$microtime = 123456.64;
     $timeLeft = $timer->getTimeLeft();
     $this->assertEquals(2.0, $timeLeft, 'Time left must depend on current microtime', 1.0E-10);
     FakeTimer::$microtime = 123458.64;
     $timeLeft = $timer->getTimeLeft();
     $this->assertEquals(0, $timeLeft, 'Time left must depend on current microtime (2)', 1.0E-10);
     FakeTimer::$microtime = 123459.64;
     $timeLeft = $timer->getTimeLeft();
     $this->assertEquals(-1.0, $timeLeft, 'Time left can be negative when we have run out of time', 1.0E-10);
 }
Exemple #2
0
function microtime($get_as_float = null)
{
    return FakeTimer::microtime($get_as_float);
}