lap example

$this->event->stop();
            }
        }
    }

    public function getStatusCode(): int
    {
        try {
            return $this->response->getStatusCode();
        } finally {
            if ($this->event?->isStarted()) {
                $this->event->lap();
            }
        }
    }

    public function getHeaders(bool $throw = true): array
    {
        try {
            return $this->response->getHeaders($throw);
        } finally {
            if ($this->event?->isStarted()) {
                $this->event->lap();
            }
$event->start();
        $event->stop();
        $event->start();
        $event->stop();
        $this->assertCount(2, $event->getPeriods());
    }

    public function testLap()
    {
        $event = new StopwatchEvent(microtime(true) * 1000);
        $event->start();
        $event->lap();
        $event->stop();
        $this->assertCount(2, $event->getPeriods());
    }

    public function testDuration()
    {
        $event = new StopwatchEvent(microtime(true) * 1000);
        $event->start();
        usleep(200000);
        $event->stop();
        $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA);

        
Home | Imprint | This part of the site doesn't use cookies.