Просмотр исходного кода

ZF-9949: Applying patch from rtuin

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23381 44c647ce-9c0f-0410-b52a-842ac1e357ba
bittarman 15 лет назад
Родитель
Сommit
270ce655c3
2 измененных файлов с 16 добавлено и 0 удалено
  1. 14 0
      library/Zend/Db/Profiler/Query.php
  2. 2 0
      tests/Zend/Db/Profiler/StaticTest.php

+ 14 - 0
library/Zend/Db/Profiler/Query.php

@@ -195,5 +195,19 @@ class Zend_Db_Profiler_Query
 
         return $this->_endedMicrotime - $this->_startedMicrotime;
     }
+
+    /**
+     * Get the time (in seconds) when the profiler started running.
+     *
+     * @return bool|float
+     */
+    public function getStartedMicrotime()
+    {
+        if(null === $this->_startedMicrotime) {
+            return false;
+        }
+
+        return $this->_startedMicrotime;
+    }
 }
 

+ 2 - 0
tests/Zend/Db/Profiler/StaticTest.php

@@ -496,6 +496,8 @@ class Zend_Db_Profiler_StaticTest extends Zend_Db_TestSetup
         $this->assertEquals(count($queries), count($queryProfiles));
 
         foreach ($queryProfiles as $queryId => $queryProfile) {
+            $this->assertNotNull($queryProfile->getStartedMicrotime());
+
             $this->assertTrue(isset($queries[$queryId]));
             $this->assertEquals($queries[$queryId]['sql'], $queryProfile->getQuery());
             $this->assertEquals($queries[$queryId]['typeExpected'], $queryProfile->getQueryType());