public function testEnsureStopped() { // this also test overlap between two periods $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); usleep(10000); $event->start(); usleep(10000); $event->ensureStopped(); $total = $event->getTotalTime(); $this->assertTrue($total >= 27 && $total <= 40); }