Пример #1
0
 /**
  * Tests the timer function.
  *
  * Originally the usleep() function took the $i variable as the number of miliseconds.
  * However because the real time the script execution is halted is not exactly the
  * number of miliseconds given (sometimes slightly less, but enough to make the assertion
  * fail), we multiply the sleep time by 1.1 just to be sure.
  */
 public function testTimer()
 {
     Timer::timer();
     for ($i = 100; $i < 1000000; $i *= 10) {
         usleep($i * 1.1);
         $delta = Timer::timer();
         $this->assertGreaterThan($i / 1000000, $delta);
     }
 }