Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / tests / Doctrine / Tests / DBAL / Functional / LoggingTest.php
1 <?php
2
3 namespace Doctrine\Tests\DBAL\Functional;
4
5 class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
6 {
7     public function testLogExecuteQuery()
8     {
9         $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
10
11         $logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger');
12         $logMock->expects($this->at(0))
13                 ->method('startQuery')
14                 ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array()));
15         $logMock->expects($this->at(1))
16                 ->method('stopQuery');
17         $this->_conn->getConfiguration()->setSQLLogger($logMock);
18         $this->_conn->executeQuery($sql, array());
19     }
20
21     public function testLogExecuteUpdate()
22     {
23         $this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).');
24
25         $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
26
27         $logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger');
28         $logMock->expects($this->at(0))
29                 ->method('startQuery')
30                 ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array()));
31         $logMock->expects($this->at(1))
32                 ->method('stopQuery');
33         $this->_conn->getConfiguration()->setSQLLogger($logMock);
34         $this->_conn->executeUpdate($sql, array());
35     }
36
37     public function testLogPrepareExecute()
38     {
39         $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
40
41         $logMock = $this->getMock('Doctrine\DBAL\Logging\SQLLogger');
42         $logMock->expects($this->once())
43                 ->method('startQuery')
44                 ->with($this->equalTo($sql), $this->equalTo(array()));
45         $logMock->expects($this->at(1))
46                 ->method('stopQuery');
47         $this->_conn->getConfiguration()->setSQLLogger($logMock);
48
49         $stmt = $this->_conn->prepare($sql);
50         $stmt->execute();
51     }
52 }