getMock('Doctrine\DBAL\Connection', array(), array(), '', false); $connectionMock->expects($this->once()) ->method('executeUpdate') ->with($this->equalTo("SET NAMES 'foo' COLLATE 'bar")); $eventArgs = new ConnectionEventArgs($connectionMock); $listener = new MysqlSessionInit('foo', 'bar'); $listener->postConnect($eventArgs); } public function testGetSubscribedEvents() { $listener = new MysqlSessionInit(); $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); } }