Change the moved pass to match the expected arguments

This commit is contained in:
Samuel ROZE 2018-09-01 18:54:58 +01:00
parent 3833f8816d
commit 37920e1499
3 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Messenger\DependencyInjection\MessengerPass;
@ -37,7 +38,9 @@ class MessengerCommandsPass implements CompilerPassInterface
$container
->getDefinition('console.command.messenger_consume_messages')
->replaceArgument(0, ServiceLocatorTagPass::register($container, $buses))
->replaceArgument(3, $this->findReceiverNames($container))
->replaceArgument(4, array_keys($buses))
;
}

View File

@ -73,7 +73,7 @@
<argument /> <!-- Message bus locator -->
<argument type="service" id="messenger.receiver_locator" />
<argument type="service" id="logger" on-invalid="null" />
<argument>null</argument> <!-- Default receiver name -->
<argument type="collection" /> <!-- Receiver names -->
<argument type="collection" /> <!-- Message bus names -->
<tag name="console.command" command="messenger:consume-messages" />

View File

@ -40,5 +40,6 @@ class MessengerCommandsPassTest extends TestCase
(new MessengerCommandsPass())->process($container);
$this->assertSame(array('amqp', 'dummy'), $container->getDefinition('console.command.messenger_consume_messages')->getArgument(3));
$this->assertSame(array('my_bus_name'), $container->getDefinition('console.command.messenger_consume_messages')->getArgument(4));
}
}