public function testLap() { $stopwatch = new Stopwatch(); $stopwatch->start('foo', 'cat'); usleep(10000); $event = $stopwatch->lap('foo'); usleep(10000); $stopwatch->stop('foo'); $this->assertInstanceof('Symfony\\Component\\HttpKernel\\Debug\\StopwatchEvent', $event); $total = $event->getTotalTime(); $this->assertTrue($total > 10 && $total <= 29, $total . ' should be 20 (between 10 and 29)'); }
public function testLap() { $stopwatch = new Stopwatch(); $stopwatch->start('foo', 'cat'); usleep(10000); $event = $stopwatch->lap('foo'); usleep(10000); $stopwatch->stop('foo'); $this->assertInstanceof('Symfony\Component\HttpKernel\Debug\StopwatchEvent', $event); $total = $event->getTotalTime(); $this->assertTrue($total >= 18 && $total <= 30); }