From dddaf8ea1d4c3941107d17dd7781de001d2a5db9 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 23 Feb 2019 01:37:29 +0100 Subject: [PATCH] improve tests --- tests/src/Util/ProfilerTest.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/src/Util/ProfilerTest.php b/tests/src/Util/ProfilerTest.php index 87796a2f37..449ec5e5ff 100644 --- a/tests/src/Util/ProfilerTest.php +++ b/tests/src/Util/ProfilerTest.php @@ -189,13 +189,29 @@ class ProfilerTest extends MockedTest } /** - * Test if no rendertime is set + * Test different enable and disable states of the profiler */ - public function testNoRenderTime() + public function testEnableDisable() { $profiler = new Profiler(true, false); $this->assertFalse($profiler->isRendertime()); $this->assertEmpty($profiler->getRendertimeString()); + + $profiler->saveTimestamp(time(), 'network', 'test1'); + + $profiler->update(false, false); + + $this->assertFalse($profiler->isRendertime()); + $this->assertEmpty($profiler->getRendertimeString()); + + $profiler->update(true, true); + + $profiler->saveTimestamp(time(), 'database', 'test2'); + + $this->assertTrue($profiler->isRendertime()); + $output = $profiler->getRendertimeString(); + $this->assertRegExp('/test1: \d+/', $output); + $this->assertRegExp('/test2: \d+/', $output); } }