コード例 #1
0
ファイル: StopwatchEventTest.php プロジェクト: rudott/symfony
 public function testEndTime()
 {
     $event = new StopwatchEvent(microtime(true) * 1000);
     $this->assertEquals(0, $event->getEndTime());
     $event = new StopwatchEvent(microtime(true) * 1000);
     $event->start();
     $this->assertEquals(0, $event->getEndTime());
     $event = new StopwatchEvent(microtime(true) * 1000);
     $event->start();
     usleep(10000);
     $event->stop();
     $event->start();
     usleep(10000);
     $event->stop();
     $end = $event->getEndTime();
     $this->assertTrue($end >= 18 && $end <= 30);
 }
コード例 #2
0
 public function testEndTime()
 {
     $event = new StopwatchEvent(microtime(true) * 1000);
     $this->assertEquals(0, $event->getEndTime());
     $event = new StopwatchEvent(microtime(true) * 1000);
     $event->start();
     $this->assertEquals(0, $event->getEndTime());
     $event = new StopwatchEvent(microtime(true) * 1000);
     $event->start();
     usleep(10000);
     $event->stop();
     $event->start();
     usleep(10000);
     $event->stop();
     $end = $event->getEndTime();
     $this->assertTrue($end >= 11 && $end <= 29, $end . ' should be 20 (between 11 and 29)');
 }