]> git.mxchange.org Git - friendica.git/commitdiff
improve tests
authorPhilipp Holzer <admin@philipp.info>
Sat, 23 Feb 2019 00:37:29 +0000 (01:37 +0100)
committerPhilipp Holzer <admin@philipp.info>
Sat, 23 Feb 2019 00:37:29 +0000 (01:37 +0100)
tests/src/Util/ProfilerTest.php

index 87796a2f37c4bbea517b3ae64e77796b015ee353..449ec5e5ff1a18d75508ee508dd23f6c2fc8d0b4 100644 (file)
@@ -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);
        }
 }