Skip to content

Commit 187240a

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Tests] Remove occurrences of `withConsecutive()` Fix support binary values in parameters. [Dotenv] Improve Dotenv::usePutenv phpdoc
2 parents 3a58fd5 + 6343af9 commit 187240a

File tree

1 file changed

+45
-19
lines changed

1 file changed

+45
-19
lines changed

Tests/Transport/ConnectionTest.php

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,29 @@ public function testItSetupsTheConnection()
296296
$amqpExchange->expects($this->once())->method('declareExchange');
297297
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
298298
$amqpQueue0->expects($this->once())->method('declareQueue');
299-
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
300-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
301-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1']
302-
);
299+
$amqpQueue0->expects($this->exactly(2))->method('bind')
300+
->willReturnCallback(function (...$args) {
301+
static $series = [
302+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0', []],
303+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1', []],
304+
];
305+
306+
$expectedArgs = array_shift($series);
307+
$this->assertSame($expectedArgs, $args);
308+
})
309+
;
303310
$amqpQueue1->expects($this->once())->method('declareQueue');
304-
$amqpQueue1->expects($this->exactly(2))->method('bind')->withConsecutive(
305-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2'],
306-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3']
307-
);
311+
$amqpQueue1->expects($this->exactly(2))->method('bind')
312+
->willReturnCallback(function (...$args) {
313+
static $series = [
314+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2', []],
315+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3', []],
316+
];
317+
318+
$expectedArgs = array_shift($series);
319+
$this->assertSame($expectedArgs, $args);
320+
})
321+
;
308322

309323
$dsn = 'amqp://localhost?'.
310324
'exchange[default_publish_routing_key]=routing_key&'.
@@ -334,15 +348,29 @@ public function testItSetupsTheTTLConnection()
334348
$amqpExchange->expects($this->once())->method('declareExchange');
335349
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
336350
$amqpQueue0->expects($this->once())->method('declareQueue');
337-
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
338-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
339-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1']
340-
);
351+
$amqpQueue0->expects($this->exactly(2))->method('bind')
352+
->willReturnCallback(function (...$args) {
353+
static $series = [
354+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0', []],
355+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1', []],
356+
];
357+
358+
$expectedArgs = array_shift($series);
359+
$this->assertSame($expectedArgs, $args);
360+
})
361+
;
341362
$amqpQueue1->expects($this->once())->method('declareQueue');
342-
$amqpQueue1->expects($this->exactly(2))->method('bind')->withConsecutive(
343-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2'],
344-
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3']
345-
);
363+
$amqpQueue1->expects($this->exactly(2))->method('bind')
364+
->willReturnCallback(function (...$args) {
365+
static $series = [
366+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2', []],
367+
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3', []],
368+
];
369+
370+
$expectedArgs = array_shift($series);
371+
$this->assertSame($expectedArgs, $args);
372+
})
373+
;
346374

347375
$dsn = 'amqps://localhost?'.
348376
'cacert=/etc/ssl/certs&'.
@@ -372,9 +400,7 @@ public function testBindingArguments()
372400
$amqpExchange->expects($this->once())->method('declareExchange');
373401
$amqpExchange->expects($this->once())->method('publish')->with('body', null, \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
374402
$amqpQueue->expects($this->once())->method('declareQueue');
375-
$amqpQueue->expects($this->exactly(1))->method('bind')->withConsecutive(
376-
[self::DEFAULT_EXCHANGE_NAME, null, ['x-match' => 'all']]
377-
);
403+
$amqpQueue->expects($this->exactly(1))->method('bind')->with(self::DEFAULT_EXCHANGE_NAME, null, ['x-match' => 'all']);
378404

379405
$dsn = 'amqp://localhost?exchange[type]=headers'.
380406
'&queues[queue0][binding_arguments][x-match]=all';

0 commit comments

Comments
 (0)