public function testConfiguratorSetsSmtpTransport() { $modulesSettingsMock = $this->getModulesSettingsMock(); $containerMock = $this->getContainerMock(); $configurator = new Configurator($modulesSettingsMock, $containerMock); // always return null: we have modules settings set for smtp $modulesSettingsMock->expects($this->exactly(6))->method('get')->will($this->onConsecutiveCalls('smtp', 'test.server.com', 25, '*****@*****.**', 'testpass')); // we want our set method to be called with a Smtp transport $containerMock->expects($this->once())->method('set')->with($this->equalTo('swiftmailer.mailer.default.transport'), $this->isInstanceOf('\\Swift_SmtpTransport')); $configurator->onKernelRequest($this->getGetResponseEventMock()); }