Elgg\TimerTest::testCapturesTimes PHP Method

testCapturesTimes() public method

public testCapturesTimes ( )
    public function testCapturesTimes()
    {
        $this->timer->begin([]);
        $this->timer->begin(['1']);
        $this->timer->begin(['1', 'a']);
        $this->timer->end(['1']);
        $this->timer->end([]);
        $times = $this->timer->getTimes();
        $begin = Timer::MARKER_BEGIN;
        $end = Timer::MARKER_END;
        $this->assertEquals([$begin, 1, $end], array_keys($times));
        $this->assertEquals([$begin, 'a', $end], array_keys($times[1]));
        $this->assertEquals([$begin], array_keys($times[1]['a']));
        $this->assertIsATime($times[$begin]);
        $this->assertIsATime($times[1][$begin]);
        $this->assertIsATime($times[1]['a'][$begin]);
        $this->assertIsATime($times[1][$end]);
        $this->assertIsATime($times[$end]);
    }