/** * @test * @expectedException \PhpAmqpLib\Exception\AMQPProtocolChannelException */ public function deleteNonExistentBindingThrowsException() { try { $this->admin->declareQueue(new Tx_Amqp_Messaging_Queue(self::TEST_QUEUE, FALSE, FALSE, TRUE)); $this->admin->deleteBinding(new Tx_Amqp_Messaging_Binding(self::TEST_QUEUE, Tx_Amqp_Messaging_Binding::DESTINATION_QUEUE, uniqid() . '_non_existent_exchange', uniqid() . '_non_existent_routing')); } catch (Exception $e) { $admin = $this->createAdminService(); $admin->deleteQueue(self::TEST_QUEUE); throw $e; } }
/** * @test */ public function testBinding() { $messageBody = 'message binding'; $this->admin->declareQueue(new Tx_Amqp_Messaging_Queue(self::TEST_QUEUE, FALSE, FALSE, TRUE)); $this->admin->purgeQueue(self::TEST_QUEUE); $this->admin->declareExchange(new Tx_Amqp_Messaging_DirectExchange(self::TEST_EXCHANGE, FALSE, TRUE)); $binding = new Tx_Amqp_Messaging_Binding(self::TEST_QUEUE, Tx_Amqp_Messaging_Binding::DESTINATION_QUEUE, self::TEST_EXCHANGE); $this->admin->declareBinding($binding); $this->service->send(new \PhpAmqpLib\Message\AMQPMessage($messageBody), self::TEST_EXCHANGE); $responseMessage = $this->service->receive(self::TEST_QUEUE); $this->assertEquals($messageBody, $responseMessage->body); $this->admin->deleteBinding($binding); // binding is released by the server because of 'autoDelete=TRUE' $this->admin->deleteQueue(self::TEST_QUEUE); }