X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FLogging%2FDebugStackTest.php;fp=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FLogging%2FDebugStackTest.php;h=00bc0b6fe80fd89e640d2a984a88e74a5383804e;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php new file mode 100644 index 0000000..00bc0b6 --- /dev/null +++ b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php @@ -0,0 +1,47 @@ +logger = new \Doctrine\DBAL\Logging\DebugStack(); + } + + public function tearDown() + { + unset($this->logger); + } + + public function testLoggedQuery() + { + $this->logger->startQuery('SELECT column FROM table'); + $this->assertEquals( + array( + 1 => array( + 'sql' => 'SELECT column FROM table', + 'params' => null, + 'types' => null, + 'executionMS' => 0, + ), + ), + $this->logger->queries + ); + + $this->logger->stopQuery(); + $this->assertGreaterThan(0, $this->logger->queries[1]['executionMS']); + } + + public function testLoggedQueryDisabled() + { + $this->logger->enabled = false; + $this->logger->startQuery('SELECT column FROM table'); + $this->assertEquals(array(), $this->logger->queries); + + $this->logger->stopQuery(); + $this->assertEquals(array(), $this->logger->queries); + } +}