From 774c86acd287e3a283f3a789770f0dc39fdee645 Mon Sep 17 00:00:00 2001 From: Anton Grebnev Date: Fri, 5 Oct 2012 19:39:45 +0400 Subject: [PATCH] modified Profiler to clear queries array on start() --- tests/util/profiler/ProfilerTest.php | 5 +++-- util/profiler/Profiler.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/util/profiler/ProfilerTest.php b/tests/util/profiler/ProfilerTest.php index 78e50ad..feda43c 100644 --- a/tests/util/profiler/ProfilerTest.php +++ b/tests/util/profiler/ProfilerTest.php @@ -95,9 +95,10 @@ class ProfilerTest extends PHPUnit_Framework_TestCase $this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false); $profiler = Profiler::getInstance(); - $cmdProfiler = $profiler->profilerCommand('command', 'type'); $profiler->start(); + $cmdProfiler = $profiler->profilerCommand('command', 'type'); + $this->assertNotNull($cmdProfiler); $result = $profiler->end(''); $this->assertNotEquals('', $result); $this->assertStringEndsNotWith(']
', $result); @@ -130,8 +131,8 @@ class ProfilerTest extends PHPUnit_Framework_TestCase $this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false); $profiler = Profiler::getInstance(); - $cmdProfiler = $profiler->profilerCommand('command', 'type'); $profiler->start(); + $cmdProfiler = $profiler->profilerCommand('command', 'type'); $result = $profiler->end(''); $this->assertNotEquals('', $result); $this->assertStringEndsNotWith(']
', $result); diff --git a/util/profiler/Profiler.php b/util/profiler/Profiler.php index 9e6fe80..dbce47b 100644 --- a/util/profiler/Profiler.php +++ b/util/profiler/Profiler.php @@ -59,6 +59,7 @@ class Profiler public function start() { + $this->queries = array(); $this->start = microtime(true); }