@@ -273,6 +273,33 @@ public function testItSetupsTheConnection()
273
273
$ connection ->publish ('body ' );
274
274
}
275
275
276
+ public function testBindingArguments ()
277
+ {
278
+ $ amqpConnection = $ this ->createMock (\AMQPConnection::class);
279
+ $ amqpChannel = $ this ->createMock (\AMQPChannel::class);
280
+ $ amqpExchange = $ this ->createMock (\AMQPExchange::class);
281
+ $ amqpQueue = $ this ->createMock (\AMQPQueue::class);
282
+
283
+ $ factory = $ this ->createMock (AmqpFactory::class);
284
+ $ factory ->method ('createConnection ' )->willReturn ($ amqpConnection );
285
+ $ factory ->method ('createChannel ' )->willReturn ($ amqpChannel );
286
+ $ factory ->method ('createExchange ' )->willReturn ($ amqpExchange );
287
+ $ factory ->method ('createQueue ' )->willReturn ($ amqpQueue );
288
+
289
+ $ amqpExchange ->expects ($ this ->once ())->method ('declareExchange ' );
290
+ $ amqpExchange ->expects ($ this ->once ())->method ('publish ' )->with ('body ' , null , AMQP_NOPARAM , ['headers ' => []]);
291
+ $ amqpQueue ->expects ($ this ->once ())->method ('declareQueue ' );
292
+ $ amqpQueue ->expects ($ this ->exactly (1 ))->method ('bind ' )->withConsecutive (
293
+ [self ::DEFAULT_EXCHANGE_NAME , null , ['x-match ' => 'all ' ]]
294
+ );
295
+
296
+ $ dsn = 'amqp://localhost?exchange[type]=headers ' .
297
+ '&queues[queue0][binding_arguments][x-match]=all ' ;
298
+
299
+ $ connection = Connection::fromDsn ($ dsn , [], $ factory );
300
+ $ connection ->publish ('body ' );
301
+ }
302
+
276
303
public function testItCanDisableTheSetup ()
277
304
{
278
305
$ factory = new TestAmqpFactory (
0 commit comments