1 | <?php |
||
2 | |||
3 | namespace Doctrine\Tests\DBAL\Logging; |
||
4 | |||
5 | class DebugStackTest extends \Doctrine\Tests\DbalTestCase |
||
6 | { |
||
7 | protected function setUp() |
||
8 | { |
||
9 | $this->logger = new \Doctrine\DBAL\Logging\DebugStack(); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
10 | } |
||
11 | |||
12 | protected function tearDown() |
||
13 | { |
||
14 | unset($this->logger); |
||
15 | } |
||
16 | |||
17 | public function testLoggedQuery() |
||
18 | { |
||
19 | $this->logger->startQuery('SELECT column FROM table'); |
||
20 | self::assertEquals( |
||
21 | array( |
||
22 | 1 => array( |
||
23 | 'sql' => 'SELECT column FROM table', |
||
24 | 'params' => null, |
||
25 | 'types' => null, |
||
26 | 'executionMS' => 0, |
||
27 | ), |
||
28 | ), |
||
29 | $this->logger->queries |
||
30 | ); |
||
31 | |||
32 | $this->logger->stopQuery(); |
||
33 | self::assertGreaterThan(0, $this->logger->queries[1]['executionMS']); |
||
34 | } |
||
35 | |||
36 | public function testLoggedQueryDisabled() |
||
37 | { |
||
38 | $this->logger->enabled = false; |
||
39 | $this->logger->startQuery('SELECT column FROM table'); |
||
40 | self::assertEquals(array(), $this->logger->queries); |
||
41 | |||
42 | $this->logger->stopQuery(); |
||
43 | self::assertEquals(array(), $this->logger->queries); |
||
44 | } |
||
45 | } |
||
46 |