@@ -356,7 +356,7 @@ public function testItSetupsTheTTLConnection()
356356 $ connection ->publish ('body ' );
357357 }
358358
359- public function testBindingArguments ()
359+ public function testQueueBindingArguments ()
360360 {
361361 $ amqpConnection = $ this ->createMock (\AMQPConnection::class);
362362 $ amqpChannel = $ this ->createMock (\AMQPChannel::class);
@@ -383,6 +383,36 @@ public function testBindingArguments()
383383 $ connection ->publish ('body ' );
384384 }
385385
386+ public function testExchangeBindingArguments ()
387+ {
388+ $ factory = new TestAmqpFactory (
389+ $ this ->createMock (\AMQPConnection::class),
390+ $ this ->createMock (\AMQPChannel::class),
391+ $ this ->createMock (\AMQPQueue::class),
392+ $ amqpExchange = $ this ->createMock (\AMQPExchange::class)
393+ );
394+
395+ $ amqpExchange ->expects ($ this ->once ())->method ('declareExchange ' );
396+ $ amqpExchange ->expects ($ this ->exactly (4 ))->method ('bind ' )->withConsecutive (
397+ ['exchange0 ' , 'binding_key0 ' , ['x-match ' => 'all ' ]],
398+ ['exchange0 ' , 'binding_key1 ' , ['x-match ' => 'all ' ]],
399+ ['exchange1 ' , 'binding_key2 ' , ['x-match ' => 'any ' ]],
400+ ['exchange1 ' , 'binding_key3 ' , ['x-match ' => 'any ' ]],
401+ );
402+ $ amqpExchange ->expects ($ this ->once ())->method ('publish ' )->with ('body ' , null , \AMQP_NOPARAM , ['headers ' => [], 'delivery_mode ' => 2 , 'timestamp ' => time ()]);
403+
404+ $ dsn = 'amqp://localhost?exchange[type]=headers ' .
405+ '&exchange[bindings][exchange0][binding_arguments][x-match]=all ' .
406+ '&exchange[bindings][exchange0][binding_keys][0]=binding_key0 ' .
407+ '&exchange[bindings][exchange0][binding_keys][1]=binding_key1 ' .
408+ '&exchange[bindings][exchange1][binding_arguments][x-match]=any ' .
409+ '&exchange[bindings][exchange1][binding_keys][0]=binding_key2 ' .
410+ '&exchange[bindings][exchange1][binding_keys][1]=binding_key3 ' ;
411+
412+ $ connection = Connection::fromDsn ($ dsn , [], $ factory );
413+ $ connection ->publish ('body ' );
414+ }
415+
386416 public function testItCanDisableTheSetup ()
387417 {
388418 $ factory = new TestAmqpFactory (
0 commit comments