getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $connectionMock->expects($this->once()) ->method('exec') ->with($this->equalTo("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'")); $eventArgs = new ConnectionEventArgs($connectionMock); $listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"); $listener->postConnect($eventArgs); } public function testGetSubscribedEvents() { $listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"); $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); } }