From f58a8c8088d3bd8cc39792d76ed8370c275e8d45 Mon Sep 17 00:00:00 2001 From: Iain Mckay Date: Fri, 10 Nov 2017 13:58:39 +0100 Subject: [PATCH 1/2] Changes SetRouterPropertiesExtension to use the driver to generate the queue name --- .../ConsumptionExtension/SetRouterPropertiesExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php index 44b7ea493..d294a9d87 100644 --- a/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php +++ b/pkg/enqueue/Client/ConsumptionExtension/SetRouterPropertiesExtension.php @@ -36,7 +36,8 @@ public function onPreReceived(Context $context) } $config = $this->driver->getConfig(); - if ($context->getPsrQueue()->getQueueName() != $config->createTransportQueueName($config->getRouterQueueName())) { + $queue = $this->driver->createQueue($config->getRouterQueueName()); + if ($context->getPsrQueue()->getQueueName() != $queue->getQueueName()) { return; } From 3a33415203c2712eee2ad2c716c9b879c8d3c007 Mon Sep 17 00:00:00 2001 From: Iain Mckay Date: Fri, 10 Nov 2017 14:15:24 +0100 Subject: [PATCH 2/2] Fixed test --- .../SetRouterPropertiesExtensionTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php index d344ed60c..1563330a2 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php @@ -30,6 +30,7 @@ public function testCouldBeConstructedWithRequiredArguments() public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue() { $config = Config::create('test', '', '', 'router-queue', '', 'router-processor-name'); + $queue = new NullQueue('test.router-queue'); $driver = $this->createDriverMock(); $driver @@ -38,6 +39,12 @@ public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue() ->willReturn($config) ; + $driver + ->expects($this->once()) + ->method('createQueue') + ->willReturn($queue) + ; + $message = new NullMessage(); $context = new Context($this->createPsrContextMock()); @@ -56,6 +63,7 @@ public function testShouldSetRouterProcessorPropertyIfNotSetAndOnRouterQueue() public function testShouldNotSetRouterProcessorPropertyIfNotSetAndNotOnRouterQueue() { $config = Config::create('test', '', '', 'router-queue', '', 'router-processor-name'); + $queue = new NullQueue('test.router-queue'); $driver = $this->createDriverMock(); $driver @@ -64,6 +72,12 @@ public function testShouldNotSetRouterProcessorPropertyIfNotSetAndNotOnRouterQue ->willReturn($config) ; + $driver + ->expects($this->once()) + ->method('createQueue') + ->willReturn($queue) + ; + $message = new NullMessage(); $context = new Context($this->createPsrContextMock());