@@ -200,6 +200,58 @@ public function processMessageProvider()
200200 );
201201 }
202202
203+ /**
204+ * @dataProvider queueBindingRoutingKeyProvider
205+ */
206+ public function testShouldConsiderQueueArgumentsOnQueueDeclaration ($ routingKeysOption , $ expectedRoutingKey )
207+ {
208+ $ queueName = 'test-queue-name ' ;
209+ $ exchangeName = 'test-exchange-name ' ;
210+ $ expectedArgs = ['test-argument ' => ['S ' , 'test-value ' ]];
211+
212+ $ this ->amqpChannel ->expects ($ this ->any ())
213+ ->method ('getChannelId ' )->willReturn (0 );
214+
215+ $ this ->amqpChannel ->expects ($ this ->any ())
216+ ->method ('queue_declare ' )
217+ ->willReturn ([$ queueName , 5 , 0 ]);
218+
219+
220+ $ this ->multipleConsumer ->setExchangeOptions ([
221+ 'declare ' => false ,
222+ 'name ' => $ exchangeName ,
223+ 'type ' => 'topic ' ]);
224+
225+ $ this ->multipleConsumer ->setQueues ([
226+ $ queueName => [
227+ 'passive ' => true ,
228+ 'durable ' => true ,
229+ 'exclusive ' => true ,
230+ 'auto_delete ' => true ,
231+ 'nowait ' => true ,
232+ 'arguments ' => $ expectedArgs ,
233+ 'ticket ' => null ,
234+ 'routing_keys ' => $ routingKeysOption ]
235+ ]);
236+
237+ $ this ->multipleConsumer ->setRoutingKey ('test-routing-key ' );
238+
239+ // we assert that arguments are passed to the bind method
240+ $ this ->amqpChannel ->expects ($ this ->once ())
241+ ->method ('queue_bind ' )
242+ ->with ($ queueName , $ exchangeName , $ expectedRoutingKey , false , $ expectedArgs );
243+
244+ $ this ->multipleConsumer ->setupFabric ();
245+ }
246+
247+ public function queueBindingRoutingKeyProvider ()
248+ {
249+ return array (
250+ array (array (), 'test-routing-key ' ),
251+ array (array ('test-routing-key-2 ' ), 'test-routing-key-2 ' ),
252+ );
253+ }
254+
203255 /**
204256 * Preparing AMQP Connection
205257 *
0 commit comments