/** * Tests the basic.return if a message cannot be delivered immediately. * * @test */ public function routeToQueueWithNoListenersShouldBasicReturn() { $this->markTestSkipped('immediate=true has been removed since RabbitMQ 3.0.0'); $queue = $this->admin->declareQueue(); $this->service->setImmediate(TRUE); $self = $this; $messageBody = 'basic.return with no consumers listening'; $this->service->send(new \PhpAmqpLib\Message\AMQPMessage($messageBody), Tx_Amqp_Messaging_AMQPService::DEFAULT_EXCHANGE, $queue->getName()); $this->service->handleReturn(function (Tx_Amqp_Messaging_UndeliverableMessage $message) use($self, $messageBody) { $self->assertEquals($messageBody, $message->getMessage()->body); Tx_Amqp_Messaging_AMQPUtils::throwStopException(); }); $this->admin->deleteQueue($queue->getName()); }