Skip to content

Commit 9843be9

Browse files
[FrameworkBundle][Messenger] Remove convention-based service id generation for buses
1 parent a0f392a commit 9843be9

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

DependencyInjection/MessengerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function registerBusToCollector(ContainerBuilder $container, string $bus
197197
(new Definition(TraceableMessageBus::class, array(new Reference($tracedBusId.'.inner'))))->setDecoratedService($busId)
198198
);
199199

200-
$container->getDefinition('messenger.data_collector')->addMethodCall('registerBus', array($tag['name'] ?? $busId, new Reference($tracedBusId)));
200+
$container->getDefinition('messenger.data_collector')->addMethodCall('registerBus', array($busId, new Reference($tracedBusId)));
201201
}
202202

203203
private function registerBusMiddlewares(ContainerBuilder $container, string $busId, array $middlewares)

Tests/DependencyInjection/MessengerPassTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,20 @@ public function testRegistersTraceableBusesToCollector()
247247

248248
$container = $this->getContainerBuilder();
249249
$container->register('messenger.data_collector', $dataCollector);
250-
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->addTag('messenger.bus', array('name' => 'foo'));
251-
$container->register($barBusId = 'messenger.bus.bar', MessageBusInterface::class)->addTag('messenger.bus');
250+
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->addTag('messenger.bus');
252251
$container->setParameter('kernel.debug', true);
253252

254253
(new MessengerPass())->process($container);
255254

256255
$this->assertTrue($container->hasDefinition($debuggedFooBusId = 'debug.traced.'.$fooBusId));
257256
$this->assertSame(array($fooBusId, null, 0), $container->getDefinition($debuggedFooBusId)->getDecoratedService());
258-
$this->assertTrue($container->hasDefinition($debuggedBarBusId = 'debug.traced.'.$barBusId));
259-
$this->assertSame(array($barBusId, null, 0), $container->getDefinition($debuggedBarBusId)->getDecoratedService());
260-
$this->assertEquals(array(array('registerBus', array('foo', new Reference($debuggedFooBusId))), array('registerBus', array('messenger.bus.bar', new Reference($debuggedBarBusId)))), $container->getDefinition('messenger.data_collector')->getMethodCalls());
257+
$this->assertEquals(array(array('registerBus', array($fooBusId, new Reference($debuggedFooBusId)))), $container->getDefinition('messenger.data_collector')->getMethodCalls());
261258
}
262259

263260
public function testRegistersMiddlewaresFromServices()
264261
{
265262
$container = $this->getContainerBuilder();
266-
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->setArgument(0, array())->addTag('messenger.bus', array('name' => 'foo'));
263+
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->setArgument(0, array())->addTag('messenger.bus');
267264
$container->register('messenger.middleware.allow_no_handler', AllowNoHandlerMiddleware::class)->setAbstract(true);
268265
$container->register(UselessMiddleware::class, UselessMiddleware::class);
269266

@@ -283,7 +280,7 @@ public function testRegistersMiddlewaresFromServices()
283280
public function testCannotRegistersAnUndefinedMiddleware()
284281
{
285282
$container = $this->getContainerBuilder();
286-
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->setArgument(0, array())->addTag('messenger.bus', array('name' => 'foo'));
283+
$container->register($fooBusId = 'messenger.bus.foo', MessageBusInterface::class)->setArgument(0, array())->addTag('messenger.bus');
287284
$container->setParameter($middlewaresParameter = $fooBusId.'.middlewares', array('not_defined_middleware'));
288285

289286
(new MessengerPass())->process($container);

0 commit comments

Comments
 (0)