Skip to content

Commit

Permalink
[Messenger] pass transport name to factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Jul 17, 2019
1 parent fe5007d commit 5205108
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder

$transportDefinition = (new Definition(TransportInterface::class))
->setFactory([new Reference('messenger.transport_factory'), 'createTransport'])
->setArguments([$transport['dsn'], $transport['options'], new Reference($serializerId)])
->setArguments([$transport['dsn'], $transport['options'] + ['transport_name' => $name], new Reference($serializerId)])
->addTag('messenger.receiver', ['alias' => $name])
;
$container->setDefinition($transportId = 'messenger.transport.'.$name, $transportDefinition);
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/FrameworkExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public function testMessengerTransports()
$this->assertEquals([new Reference('messenger.transport_factory'), 'createTransport'], $transportFactory);
$this->assertCount(3, $transportArguments);
$this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $transportArguments[0]);
$this->assertEquals(['queue' => ['name' => 'Queue']], $transportArguments[1]);
$this->assertEquals(['queue' => ['name' => 'Queue'], 'transport_name' => 'customised'], $transportArguments[1]);
$this->assertEquals(new Reference('messenger.transport.native_php_serializer'), $transportArguments[2]);

$this->assertTrue($container->hasDefinition('messenger.transport.amqp.factory'));
Expand Down

0 comments on commit 5205108

Please sign in to comment.