]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/ProfilerTest.php
And again
[friendica.git] / tests / src / Util / ProfilerTest.php
index 45b29943f507a893be49cf8513f03810dcb7a6ce..6847e63f3d45febd5b5a81b57cd6256533ead5d5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -35,7 +35,7 @@ class ProfilerTest extends MockedTest
         */
        private $logger;
 
-       protected function setUp()
+       protected function setUp(): void
        {
                parent::setUp();
 
@@ -53,6 +53,8 @@ class ProfilerTest extends MockedTest
                            ->andReturn(true)
                            ->twice();
                $profiler = new Profiler($configCache);
+
+               self::assertInstanceOf(Profiler::class, $profiler);
        }
 
        /**
@@ -141,7 +143,7 @@ class ProfilerTest extends MockedTest
         * Test the Profiler reset
         * @dataProvider dataPerformance
         */
-       public function testReset($timestamp, $name, array $functions)
+       public function testReset($timestamp, $name)
        {
                $configCache = \Mockery::mock(Cache::class);
                $configCache->shouldReceive('get')
@@ -248,11 +250,12 @@ class ProfilerTest extends MockedTest
                            ->once();
 
                $profiler = new Profiler($configCache);
+               $profiler->startRecording('network');
 
                self::assertFalse($profiler->isRendertime());
                self::assertEmpty($profiler->getRendertimeString());
 
-               $profiler->saveTimestamp(time(), 'network', 'test1');
+               $profiler->stopRecording('test1');
 
                $config = \Mockery::mock(IConfig::class);
                $config->shouldReceive('get')
@@ -280,7 +283,8 @@ class ProfilerTest extends MockedTest
 
                $profiler->update($config);
 
-               $profiler->saveTimestamp(time(), 'database', 'test2');
+               $profiler->startRecording('database');
+               $profiler->stopRecording('test2');
 
                self::assertTrue($profiler->isRendertime());
                $output = $profiler->getRendertimeString();