Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  fix compatibility with Twig 3.10
  [Strings][EnglishInflector] Fix incorrect pluralisation of 'Album'
  handle union and intersection types for cascaded validations
  move wiring of the property info extractor to the ObjectNormalizer
  restore deprecated properties
  move Process component dep to require-dev
  Remove calls to `onConsecutiveCalls()`
  fix: remove unwanted type cast
  accept AbstractAsset instances when filtering schemas
  better distinguish URL schemes and windows drive letters
  handle edge cases when constructing constraints with named arguments
  convert empty CSV header names into numeric keys
  • Loading branch information
derrabus committed May 2, 2024
2 parents 65ed12f + 850c43b commit b3e482a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
10 changes: 5 additions & 5 deletions Tests/Transport/AmqpSenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testItSendsTheEncodedMessage()
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];

$serializer = $this->createMock(SerializerInterface::class);
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
$serializer->method('encode')->with($envelope)->willReturn($encoded);

$connection = $this->createMock(Connection::class);
$connection->expects($this->once())->method('publish')->with($encoded['body'], $encoded['headers']);
Expand Down Expand Up @@ -61,7 +61,7 @@ public function testItSendsTheEncodedMessageWithoutHeaders()
$encoded = ['body' => '...'];

$serializer = $this->createMock(SerializerInterface::class);
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
$serializer->method('encode')->with($envelope)->willReturn($encoded);

$connection = $this->createMock(Connection::class);
$connection->expects($this->once())->method('publish')->with($encoded['body'], []);
Expand All @@ -76,7 +76,7 @@ public function testContentTypeHeaderIsMovedToAttribute()
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class, 'Content-Type' => 'application/json']];

$serializer = $this->createMock(SerializerInterface::class);
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
$serializer->method('encode')->with($envelope)->willReturn($encoded);

$connection = $this->createMock(Connection::class);
unset($encoded['headers']['Content-Type']);
Expand All @@ -93,7 +93,7 @@ public function testContentTypeHeaderDoesNotOverwriteAttribute()
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class, 'Content-Type' => 'application/json']];

$serializer = $this->createMock(SerializerInterface::class);
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
$serializer->method('encode')->with($envelope)->willReturn($encoded);

$connection = $this->createMock(Connection::class);
unset($encoded['headers']['Content-Type']);
Expand All @@ -110,7 +110,7 @@ public function testItThrowsATransportExceptionIfItCannotSendTheMessage()
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];

$serializer = $this->createMock(SerializerInterface::class);
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
$serializer->method('encode')->with($envelope)->willReturn($encoded);

$connection = $this->createMock(Connection::class);
$connection->method('publish')->with($encoded['body'], $encoded['headers'])->willThrowException(new \AMQPException());
Expand Down
66 changes: 32 additions & 34 deletions Tests/Transport/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ public function testItSetupsTheConnection()
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createExchange')->willReturn($amqpExchange);
$factory->method('createQueue')->will($this->onConsecutiveCalls($amqpQueue0, $amqpQueue1));

$factory
->method('createQueue')
->willReturn($amqpQueue0, $amqpQueue1);

$amqpExchange->expects($this->once())->method('declareExchange');
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
Expand Down Expand Up @@ -343,7 +346,9 @@ public function testItSetupsTheTTLConnection()
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createExchange')->willReturn($amqpExchange);
$factory->method('createQueue')->will($this->onConsecutiveCalls($amqpQueue0, $amqpQueue1));
$factory
->method('createQueue')
->willReturn($amqpQueue0, $amqpQueue1);

$amqpExchange->expects($this->once())->method('declareExchange');
$amqpExchange->expects($this->once())->method('publish')->with('body', 'routing_key', \AMQP_NOPARAM, ['headers' => [], 'delivery_mode' => 2, 'timestamp' => time()]);
Expand Down Expand Up @@ -458,14 +463,15 @@ public function testAutoSetupWithDelayDeclaresExchangeQueuesAndDelay()
$factory = $this->createMock(AmqpFactory::class);
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createQueue')->will($this->onConsecutiveCalls(
$amqpQueue = $this->createMock(\AMQPQueue::class),
$delayQueue = $this->createMock(\AMQPQueue::class)
));
$factory->method('createExchange')->will($this->onConsecutiveCalls(
$amqpExchange = $this->createMock(\AMQPExchange::class),
$delayExchange = $this->createMock(\AMQPExchange::class)
));

$amqpQueue = $this->createMock(\AMQPQueue::class);
$factory
->method('createQueue')
->willReturn($amqpQueue, $this->createMock(\AMQPQueue::class));

$amqpExchange = $this->createMock(\AMQPExchange::class);
$delayExchange = $this->createMock(\AMQPExchange::class);
$factory->method('createExchange')->willReturn($amqpExchange, $delayExchange);

$amqpExchange->expects($this->once())->method('setName')->with(self::DEFAULT_EXCHANGE_NAME);
$amqpExchange->expects($this->once())->method('declareExchange');
Expand Down Expand Up @@ -516,14 +522,12 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs()
$factory = $this->createMock(AmqpFactory::class);
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createQueue')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPQueue::class),
$delayQueue = $this->createMock(\AMQPQueue::class)
));
$factory->method('createExchange')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPExchange::class),
$delayExchange = $this->createMock(\AMQPExchange::class)
));

$delayQueue = $this->createMock(\AMQPQueue::class);
$factory->method('createQueue')->willReturn($this->createMock(\AMQPQueue::class), $delayQueue);

$delayExchange = $this->createMock(\AMQPExchange::class);
$factory->method('createExchange')->willReturn($this->createMock(\AMQPExchange::class), $delayExchange);

$connectionOptions = [
'retry' => [
Expand Down Expand Up @@ -656,14 +660,12 @@ public function testItDelaysTheMessageWithTheInitialSuppliedRoutingKeyAsArgument
$factory = $this->createMock(AmqpFactory::class);
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createQueue')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPQueue::class),
$delayQueue = $this->createMock(\AMQPQueue::class)
));
$factory->method('createExchange')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPExchange::class),
$delayExchange = $this->createMock(\AMQPExchange::class)
));

$delayQueue = $this->createMock(\AMQPQueue::class);
$factory->method('createQueue')->willReturn($this->createMock(\AMQPQueue::class), $delayQueue);

$delayExchange = $this->createMock(\AMQPExchange::class);
$factory->method('createExchange')->willReturn($this->createMock(\AMQPExchange::class), $delayExchange);

$connectionOptions = [
'retry' => [
Expand Down Expand Up @@ -849,14 +851,10 @@ private function createDelayOrRetryConnection(\AMQPExchange $delayExchange, stri
$factory = $this->createMock(AmqpFactory::class);
$factory->method('createConnection')->willReturn($amqpConnection);
$factory->method('createChannel')->willReturn($amqpChannel);
$factory->method('createQueue')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPQueue::class),
$delayQueue = $this->createMock(\AMQPQueue::class)
));
$factory->method('createExchange')->will($this->onConsecutiveCalls(
$this->createMock(\AMQPExchange::class),
$delayExchange
));

$delayQueue = $this->createMock(\AMQPQueue::class);
$factory->method('createQueue')->willReturn($this->createMock(\AMQPQueue::class), $delayQueue);
$factory->method('createExchange')->willReturn($this->createMock(\AMQPExchange::class), $delayExchange);

$delayQueue->expects($this->once())->method('setName')->with($delayQueueName);
$delayQueue->expects($this->once())->method('setArguments')->with([
Expand Down

0 comments on commit b3e482a

Please sign in to comment.