X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FUtil%2FProfilerTest.php;h=25d044354c6534a59367a7ae8a50f55432066cc3;hb=2292263780000a50e1e7583bc170cca619d86f42;hp=30e60b209b1707a5579be95e166a3589b580970b;hpb=aa0b485f3dca72c5448076e913fa54d948cd7731;p=friendica.git diff --git a/tests/src/Util/ProfilerTest.php b/tests/src/Util/ProfilerTest.php index 30e60b209b..25d044354c 100644 --- a/tests/src/Util/ProfilerTest.php +++ b/tests/src/Util/ProfilerTest.php @@ -1,6 +1,6 @@ andReturn(true) ->twice(); $profiler = new Profiler($configCache); + + self::assertInstanceOf(Profiler::class, $profiler); } /** @@ -97,14 +99,14 @@ class ProfilerTest extends MockedTest 'name' => 'rendering', 'functions' => ['test', 'it7'], ], - 'parser' => [ + 'session' => [ 'timestamp' => time(), - 'name' => 'parser', + 'name' => 'session', 'functions' => ['test', 'it8'], ], 'marktime' => [ 'timestamp' => time(), - 'name' => 'parser', + 'name' => 'session', 'functions' => ['test'], ], // This one isn't set during reset @@ -134,14 +136,14 @@ class ProfilerTest extends MockedTest $profiler->saveTimestamp($timestamp, $name, $function); } - $this->assertGreaterThanOrEqual(0, $profiler->get($name)); + self::assertGreaterThanOrEqual(0, $profiler->get($name)); } /** * 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') @@ -154,7 +156,7 @@ class ProfilerTest extends MockedTest $profiler->saveTimestamp($timestamp, $name); $profiler->reset(); - $this->assertEquals(0, $profiler->get($name)); + self::assertEquals(0, $profiler->get($name)); } public function dataBig() @@ -227,7 +229,7 @@ class ProfilerTest extends MockedTest foreach ($data as $perf => $items) { foreach ($items['functions'] as $function) { // assert that the output contains the functions - $this->assertRegExp('/' . $function . ': \d+/', $output); + self::assertMatchesRegularExpression('/' . $function . ': \d+/', $output); } } } @@ -249,12 +251,12 @@ class ProfilerTest extends MockedTest $profiler = new Profiler($configCache); - $this->assertFalse($profiler->isRendertime()); - $this->assertEmpty($profiler->getRendertimeString()); + self::assertFalse($profiler->isRendertime()); + self::assertEmpty($profiler->getRendertimeString()); $profiler->saveTimestamp(time(), 'network', 'test1'); - $config = \Mockery::mock(IConfig::class); + $config = \Mockery::mock(IManageConfigValues::class); $config->shouldReceive('get') ->with('system', 'profiler') ->andReturn(false) @@ -266,8 +268,8 @@ class ProfilerTest extends MockedTest $profiler->update($config); - $this->assertFalse($profiler->isRendertime()); - $this->assertEmpty($profiler->getRendertimeString()); + self::assertFalse($profiler->isRendertime()); + self::assertEmpty($profiler->getRendertimeString()); $config->shouldReceive('get') ->with('system', 'profiler') @@ -282,9 +284,9 @@ class ProfilerTest extends MockedTest $profiler->saveTimestamp(time(), 'database', 'test2'); - $this->assertTrue($profiler->isRendertime()); + self::assertTrue($profiler->isRendertime()); $output = $profiler->getRendertimeString(); - $this->assertRegExp('/test1: \d+/', $output); - $this->assertRegExp('/test2: \d+/', $output); + self::assertMatchesRegularExpression('/test1: \d+/', $output); + self::assertMatchesRegularExpression('/test2: \d+/', $output); } }