3 namespace Doctrine\Tests\DBAL\Functional;
5 class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase
7 public function testLogExecuteQuery()
9 $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
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());
21 public function testLogExecuteUpdate()
23 $this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).');
25 $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
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());
37 public function testLogPrepareExecute()
39 $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
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);
49 $stmt = $this->_conn->prepare($sql);