/**
  * @test
  */
 public function handle_should_log_message_with_payload()
 {
     $exceptionMessage = "Fatal error";
     $baseException = new Exception($exceptionMessage);
     $payloadMessage = $this->prophesize(MessageInterface::class);
     $exception = new ConsumerContainerException($this->consumerContainer->reveal(), new AMQPMessage(), $payloadMessage->reveal(), $baseException);
     $this->handler->handle($exception);
     $this->logger->warning(Argument::allOf(Argument::containingString(self::MESSAGE_CLASS), Argument::containingString($exceptionMessage)), Argument::that(function ($context) use($baseException) {
         verify($context['exception'])->isInstanceOf(ConsumerContainerException::class);
         verify($context['exception']->getPrevious())->equals($baseException);
         return $context;
     }))->shouldHaveBeenCalled();
 }
 /**
  * @test
  */
 public function handle_should_use_existing_headers()
 {
     $table = new AMQPTable();
     $exceptionMessage = "Fatal error";
     $exception = new Exception($exceptionMessage);
     $payloadMessage = new Message();
     $amqpMessage = $this->prophesize(AMQPMessage::class);
     $amqpMessage->has('application_headers')->willReturn(true);
     $amqpMessage->get('application_headers')->willReturn($table);
     $amqpMessage->set('application_headers', $table)->shouldBeCalled();
     $this->client->sendMessage($amqpMessage->reveal(), self::CONSUMER_IDENTIFICATION)->shouldBeCalled();
     $exception = new ConsumerContainerException($this->consumerContainer->reveal(), $amqpMessage->reveal(), $payloadMessage, $exception);
     $this->handler->handle($exception);
 }