public function testHandleAndWriteWithUnavailableProducer() { $testRecord = array('level' => Logger::INFO, 'testmessage' => 'testmessage', 'datetime' => new \DateTime(), 'extra' => array(), 'formatted' => array()); $testProperties = array('application_headers' => array("x-riak-target-vnode" => array("S", $this->vNode))); $this->formatterMock->expects($this->once())->method('format')->with($testRecord)->will($this->returnValue(array())); $this->messageProducerMock->expects($this->once())->method('publish')->with(json_encode($testRecord), $this->routingKey, $testProperties)->will($this->throwException(new \ErrorException('AMQPConnection failed'))); $this->rabbitMqHandler->addAdditionalProperties($testProperties); $this->rabbitMqHandler->setFormatter($this->formatterMock); $this->assertFalse($this->rabbitMqHandler->handle($testRecord)); $this->assertTrue($this->rabbitMqHandler->getBubble()); }