@@ -96,7 +96,7 @@ public function testShouldBindDefaultQueueOnly()
9696 $ driver
9797 ->expects ($ this ->once ())
9898 ->method ('createQueue ' )
99- ->with ('default ' )
99+ ->with ('default ' , true )
100100 ->willReturn ($ queue )
101101 ;
102102
@@ -153,7 +153,7 @@ public function testShouldUseRequestedClient()
153153 $ fooDriver
154154 ->expects ($ this ->once ())
155155 ->method ('createQueue ' )
156- ->with ('default ' )
156+ ->with ('default ' , true )
157157 ->willReturn ($ queue )
158158 ;
159159
@@ -235,7 +235,7 @@ public function testShouldBindDefaultQueueIfRouteUseDifferentQueue()
235235 $ driver
236236 ->expects ($ this ->once ())
237237 ->method ('createQueue ' )
238- ->with ('default ' )
238+ ->with ('default ' , true )
239239 ->willReturn ($ queue )
240240 ;
241241
@@ -264,13 +264,13 @@ public function testShouldBindCustomExecuteConsumptionAndUseCustomClientDestinat
264264 $ driver
265265 ->expects ($ this ->at (3 ))
266266 ->method ('createQueue ' )
267- ->with ('default ' )
267+ ->with ('default ' , true )
268268 ->willReturn ($ defaultQueue )
269269 ;
270270 $ driver
271271 ->expects ($ this ->at (4 ))
272272 ->method ('createQueue ' )
273- ->with ('custom ' )
273+ ->with ('custom ' , true )
274274 ->willReturn ($ customQueue )
275275 ;
276276
@@ -307,6 +307,7 @@ public function testShouldBindUserProvidedQueues()
307307
308308 $ routeCollection = new RouteCollection ([
309309 new Route ('topic ' , Route::TOPIC , 'processor ' , ['queue ' => 'custom ' ]),
310+ new Route ('topic ' , Route::TOPIC , 'processor ' , ['queue ' => 'non-default-queue ' ]),
310311 ]);
311312
312313 $ processor = $ this ->createDelegateProcessorMock ();
@@ -315,7 +316,7 @@ public function testShouldBindUserProvidedQueues()
315316 $ driver
316317 ->expects ($ this ->once ())
317318 ->method ('createQueue ' )
318- ->with ('non-default-queue ' )
319+ ->with ('non-default-queue ' , true )
319320 ->willReturn ($ queue )
320321 ;
321322
@@ -343,6 +344,48 @@ public function testShouldBindUserProvidedQueues()
343344 ]);
344345 }
345346
347+ public function testShouldBindNotPrefixedQueue ()
348+ {
349+ $ queue = new NullQueue ('' );
350+
351+ $ routeCollection = new RouteCollection ([
352+ new Route ('topic ' , Route::TOPIC , 'processor ' , ['queue ' => 'non-prefixed-queue ' , 'prefix_queue ' => false ]),
353+ ]);
354+
355+ $ processor = $ this ->createDelegateProcessorMock ();
356+
357+ $ driver = $ this ->createDriverStub ($ routeCollection );
358+ $ driver
359+ ->expects ($ this ->once ())
360+ ->method ('createQueue ' )
361+ ->with ('non-prefixed-queue ' , false )
362+ ->willReturn ($ queue )
363+ ;
364+
365+ $ consumer = $ this ->createQueueConsumerMock ();
366+ $ consumer
367+ ->expects ($ this ->once ())
368+ ->method ('bind ' )
369+ ->with ($ this ->identicalTo ($ queue ), $ this ->identicalTo ($ processor ))
370+ ;
371+ $ consumer
372+ ->expects ($ this ->once ())
373+ ->method ('consume ' )
374+ ->with ($ this ->isInstanceOf (ChainExtension::class))
375+ ;
376+
377+ $ command = new ConsumeCommand (new Container ([
378+ 'enqueue.client.default.queue_consumer ' => $ consumer ,
379+ 'enqueue.client.default.driver ' => $ driver ,
380+ 'enqueue.client.default.delegate_processor ' => $ processor ,
381+ ]));
382+
383+ $ tester = new CommandTester ($ command );
384+ $ tester ->execute ([
385+ 'client-queue-names ' => ['non-prefixed-queue ' ],
386+ ]);
387+ }
388+
346389 public function testShouldBindQueuesOnlyOnce ()
347390 {
348391 $ defaultQueue = new NullQueue ('' );
@@ -360,12 +403,12 @@ public function testShouldBindQueuesOnlyOnce()
360403 $ driver
361404 ->expects ($ this ->at (3 ))
362405 ->method ('createQueue ' )
363- ->with ('default ' )
406+ ->with ('default ' , true )
364407 ->willReturn ($ defaultQueue )
365408 ;
366409 $ driver
367410 ->expects ($ this ->at (4 ))
368- ->method ('createQueue ' )
411+ ->method ('createQueue ' , true )
369412 ->with ('custom ' )
370413 ->willReturn ($ customQueue )
371414 ;
@@ -397,6 +440,47 @@ public function testShouldBindQueuesOnlyOnce()
397440 $ tester ->execute ([]);
398441 }
399442
443+ public function testShouldNotBindExternalRoutes ()
444+ {
445+ $ defaultQueue = new NullQueue ('' );
446+
447+ $ routeCollection = new RouteCollection ([
448+ new Route ('barTopic ' , Route::TOPIC , 'processor ' , ['queue ' => null ]),
449+ new Route ('fooTopic ' , Route::TOPIC , 'processor ' , ['queue ' => 'external_queue ' , 'external ' => true ]),
450+ ]);
451+
452+ $ processor = $ this ->createDelegateProcessorMock ();
453+
454+ $ driver = $ this ->createDriverStub ($ routeCollection );
455+ $ driver
456+ ->expects ($ this ->exactly (1 ))
457+ ->method ('createQueue ' )
458+ ->with ('default ' , true )
459+ ->willReturn ($ defaultQueue )
460+ ;
461+
462+ $ consumer = $ this ->createQueueConsumerMock ();
463+ $ consumer
464+ ->expects ($ this ->exactly (1 ))
465+ ->method ('bind ' )
466+ ->with ($ this ->identicalTo ($ defaultQueue ), $ this ->identicalTo ($ processor ))
467+ ;
468+ $ consumer
469+ ->expects ($ this ->at (1 ))
470+ ->method ('consume ' )
471+ ->with ($ this ->isInstanceOf (ChainExtension::class))
472+ ;
473+
474+ $ command = new ConsumeCommand (new Container ([
475+ 'enqueue.client.default.queue_consumer ' => $ consumer ,
476+ 'enqueue.client.default.driver ' => $ driver ,
477+ 'enqueue.client.default.delegate_processor ' => $ processor ,
478+ ]));
479+
480+ $ tester = new CommandTester ($ command );
481+ $ tester ->execute ([]);
482+ }
483+
400484 public function testShouldSkipQueueConsumptionAndUseCustomClientDestinationName ()
401485 {
402486 $ queue = new NullQueue ('' );
@@ -423,19 +507,19 @@ public function testShouldSkipQueueConsumptionAndUseCustomClientDestinationName(
423507 $ driver = $ this ->createDriverStub ($ routeCollection );
424508 $ driver
425509 ->expects ($ this ->at (3 ))
426- ->method ('createQueue ' )
510+ ->method ('createQueue ' , true )
427511 ->with ('default ' )
428512 ->willReturn ($ queue )
429513 ;
430514 $ driver
431515 ->expects ($ this ->at (4 ))
432- ->method ('createQueue ' )
516+ ->method ('createQueue ' , true )
433517 ->with ('fooQueue ' )
434518 ->willReturn ($ queue )
435519 ;
436520 $ driver
437521 ->expects ($ this ->at (5 ))
438- ->method ('createQueue ' )
522+ ->method ('createQueue ' , true )
439523 ->with ('ololoQueue ' )
440524 ->willReturn ($ queue )
441525 ;
0 commit comments