Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Logging / DebugStackTest.php
1 <?php
2
3 namespace Doctrine\Tests\DBAL\Logging;
4
5 require_once __DIR__ . '/../../TestInit.php';
6
7 class DebugStackTest extends \Doctrine\Tests\DbalTestCase
8 {
9     public function setUp()
10     {
11         $this->logger = new \Doctrine\DBAL\Logging\DebugStack();
12     }
13
14     public function tearDown()
15     {
16         unset($this->logger);
17     }
18
19     public function testLoggedQuery()
20     {
21         $this->logger->startQuery('SELECT column FROM table');
22         $this->assertEquals(
23             array(
24                 1 => array(
25                     'sql' => 'SELECT column FROM table',
26                     'params' => null,
27                     'types' => null,
28                     'executionMS' => 0,
29                 ),
30             ),
31             $this->logger->queries
32         );
33
34         $this->logger->stopQuery();
35         $this->assertGreaterThan(0, $this->logger->queries[1]['executionMS']);
36     }
37
38     public function testLoggedQueryDisabled()
39     {
40         $this->logger->enabled = false;
41         $this->logger->startQuery('SELECT column FROM table');
42         $this->assertEquals(array(), $this->logger->queries);
43
44         $this->logger->stopQuery();
45         $this->assertEquals(array(), $this->logger->queries);
46     }
47 }