objectManager = new ObjectManager($this); $this->topologyConfigMock = $this->createMock(ConfigInterface::class); $this->loggerMock = $this->createMock(LoggerInterface::class); $this->topologyInstaller = $this->objectManager->getObject( TopologyInstaller::class, ['topologyConfig' => $this->topologyConfigMock, 'logger' => $this->loggerMock] ); parent::setUp(); } /** * Make sure that topology creation errors in log contain actual error message. */ public function testInstallException() { $exceptionMessage = "Exception message"; $this->topologyConfigMock ->expects($this->once()) ->method('getQueues') ->willThrowException(new AMQPLogicException($exceptionMessage)); $this->loggerMock ->expects($this->once()) ->method('error') ->with($this->stringContains("AMQP topology installation failed: {$exceptionMessage}")); $this->topologyInstaller->install(); } }