@@ -128,7 +128,7 @@ public function testSetsParametersOnTheQueueAndExchange()
128
128
'alternate-exchange ' => 'alternate ' ,
129
129
],
130
130
],
131
- ], true , $ factory );
131
+ ], $ factory );
132
132
$ connection ->publish ('body ' );
133
133
}
134
134
@@ -171,9 +171,11 @@ public function testItUsesANormalConnectionByDefault()
171
171
$ amqpExchange = $ this ->getMockBuilder (\AMQPExchange::class)->disableOriginalConstructor ()->getMock ()
172
172
);
173
173
174
+ // makes sure the channel looks connected, so it's not re-created
175
+ $ amqpChannel ->expects ($ this ->once ())->method ('isConnected ' )->willReturn (true );
174
176
$ amqpConnection ->expects ($ this ->once ())->method ('connect ' );
175
177
176
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages ' , [], false , $ factory );
178
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages ' , [], $ factory );
177
179
$ connection ->publish ('body ' );
178
180
}
179
181
@@ -186,13 +188,15 @@ public function testItAllowsToUseAPersistentConnection()
186
188
$ amqpExchange = $ this ->getMockBuilder (\AMQPExchange::class)->disableOriginalConstructor ()->getMock ()
187
189
);
188
190
191
+ // makes sure the channel looks connected, so it's not re-created
192
+ $ amqpChannel ->expects ($ this ->once ())->method ('isConnected ' )->willReturn (true );
189
193
$ amqpConnection ->expects ($ this ->once ())->method ('pconnect ' );
190
194
191
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?persistent=true ' , [], false , $ factory );
195
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?persistent=true ' , [], $ factory );
192
196
$ connection ->publish ('body ' );
193
197
}
194
198
195
- public function testItSetupsTheConnectionWhenDebug ()
199
+ public function testItSetupsTheConnectionByDefault ()
196
200
{
197
201
$ factory = new TestAmqpFactory (
198
202
$ amqpConnection = $ this ->getMockBuilder (\AMQPConnection::class)->disableOriginalConstructor ()->getMock (),
@@ -206,7 +210,7 @@ public function testItSetupsTheConnectionWhenDebug()
206
210
$ amqpQueue ->expects ($ this ->once ())->method ('declareQueue ' );
207
211
$ amqpQueue ->expects ($ this ->once ())->method ('bind ' )->with ('exchange_name ' , 'my_key ' );
208
212
209
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , [], true , $ factory );
213
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , [], $ factory );
210
214
$ connection ->publish ('body ' );
211
215
}
212
216
@@ -224,13 +228,13 @@ public function testItCanDisableTheSetup()
224
228
$ amqpQueue ->expects ($ this ->never ())->method ('declareQueue ' );
225
229
$ amqpQueue ->expects ($ this ->never ())->method ('bind ' );
226
230
227
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , ['auto-setup ' => 'false ' ], true , $ factory );
231
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , ['auto-setup ' => 'false ' ], $ factory );
228
232
$ connection ->publish ('body ' );
229
233
230
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , ['auto-setup ' => false ], true , $ factory );
234
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key ' , ['auto-setup ' => false ], $ factory );
231
235
$ connection ->publish ('body ' );
232
236
233
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false ' , [], true , $ factory );
237
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[routing_key]=my_key&auto-setup=false ' , [], $ factory );
234
238
$ connection ->publish ('body ' );
235
239
}
236
240
@@ -248,7 +252,7 @@ public function testPublishWithQueueOptions()
248
252
$ amqpExchange ->expects ($ this ->once ())->method ('publish ' )
249
253
->with ('body ' , null , 1 , ['delivery_mode ' => 2 , 'headers ' => ['token ' => 'uuid ' , 'type ' => '* ' ]]);
250
254
251
- $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[attributes][delivery_mode]=2&queue[attributes][headers][token]=uuid&queue[flags]=1 ' , [], true , $ factory );
255
+ $ connection = Connection::fromDsn ('amqp://localhost/%2f/messages?queue[attributes][delivery_mode]=2&queue[attributes][headers][token]=uuid&queue[flags]=1 ' , [], $ factory );
252
256
$ connection ->publish ('body ' , $ headers );
253
257
}
254
258
}
0 commit comments