Skip to content

Commit

Permalink
Merge branch '5.4' into 6.2
Browse files Browse the repository at this point in the history
* 5.4:
  [Tests] Remove occurrences of `withConsecutive()`
  Fix support binary values in parameters.
  [Dotenv] Improve Dotenv::usePutenv phpdoc
  • Loading branch information
nicolas-grekas committed Mar 10, 2023
2 parents 3a58fd5 + 6343af9 commit 187240a
Showing 1 changed file with 45 additions and 19 deletions.
64 changes: 45 additions & 19 deletions Tests/Transport/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,29 @@ public function testItSetupsTheConnection()
$amqpExchange->expects($this->once())->method('declareExchange');
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
$amqpQueue0->expects($this->once())->method('declareQueue');
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1']
);
$amqpQueue0->expects($this->exactly(2))->method('bind')
->willReturnCallback(function (...$args) {
static $series = [
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0', []],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1', []],
];

$expectedArgs = array_shift($series);
$this->assertSame($expectedArgs, $args);
})
;
$amqpQueue1->expects($this->once())->method('declareQueue');
$amqpQueue1->expects($this->exactly(2))->method('bind')->withConsecutive(
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2'],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3']
);
$amqpQueue1->expects($this->exactly(2))->method('bind')
->willReturnCallback(function (...$args) {
static $series = [
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2', []],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3', []],
];

$expectedArgs = array_shift($series);
$this->assertSame($expectedArgs, $args);
})
;

$dsn = 'amqp://localhost?'.
'exchange[default_publish_routing_key]=routing_key&'.
Expand Down Expand Up @@ -334,15 +348,29 @@ public function testItSetupsTheTTLConnection()
$amqpExchange->expects($this->once())->method('declareExchange');
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
$amqpQueue0->expects($this->once())->method('declareQueue');
$amqpQueue0->expects($this->exactly(2))->method('bind')->withConsecutive(
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0'],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1']
);
$amqpQueue0->expects($this->exactly(2))->method('bind')
->willReturnCallback(function (...$args) {
static $series = [
[self::DEFAULT_EXCHANGE_NAME, 'binding_key0', []],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key1', []],
];

$expectedArgs = array_shift($series);
$this->assertSame($expectedArgs, $args);
})
;
$amqpQueue1->expects($this->once())->method('declareQueue');
$amqpQueue1->expects($this->exactly(2))->method('bind')->withConsecutive(
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2'],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3']
);
$amqpQueue1->expects($this->exactly(2))->method('bind')
->willReturnCallback(function (...$args) {
static $series = [
[self::DEFAULT_EXCHANGE_NAME, 'binding_key2', []],
[self::DEFAULT_EXCHANGE_NAME, 'binding_key3', []],
];

$expectedArgs = array_shift($series);
$this->assertSame($expectedArgs, $args);
})
;

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

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

0 comments on commit 187240a

Please sign in to comment.