public function testTaggedInvokableEventListener() { $container =
new ContainerBuilder();
$container->
registerAttributeForAutoconfiguration(AsEventListener::
class,
static function DChildDefinition
$definition, AsEventListener
$attribute): void
{ $definition->
addTag('kernel.event_listener',
get_object_vars($attribute));
});
$container->
register('foo', TaggedInvokableListener::
class)->
setAutoconfigured(true
);
$container->
register('event_dispatcher', \stdClass::
class);
(new AttributeAutoconfigurationPass())->
process($container);
(new ResolveInstanceofConditionalsPass())->
process($container);
(new RegisterListenersPass())->
process($container);
$definition =
$container->
getDefinition('event_dispatcher'
);
$expectedCalls =
[ [ 'addListener',
[ CustomEvent::
class,
[new ServiceClosureArgument(new Reference('foo'
)), '__invoke'
],
0,
],