diff --git a/tests/CompiledListenerProviderTest.php b/tests/CompiledListenerProviderTest.php index 4f0c8fe..592f870 100644 --- a/tests/CompiledListenerProviderTest.php +++ b/tests/CompiledListenerProviderTest.php @@ -333,7 +333,7 @@ public function detects_invoke_method_and_gives_class_id_by_default(): void $builder = new ProviderBuilder(); $container = new MockContainer(); - $container->addService(InvokableListenerClassNoId::class, new InvokableListenerClassNoId()); + $container->addService(InvokableListenerClassNoId::class, new InvokableListenerClassNoId('beep')); $container->addService(InvokableListenerClassNoIdBefore::class, new InvokableListenerClassNoIdBefore()); $builder->listenerService(InvokableListenerClassNoId::class); diff --git a/tests/Listeners/InvokableListenerClassNoId.php b/tests/Listeners/InvokableListenerClassNoId.php index b10b855..79879c1 100644 --- a/tests/Listeners/InvokableListenerClassNoId.php +++ b/tests/Listeners/InvokableListenerClassNoId.php @@ -8,6 +8,8 @@ #[ListenerPriority(priority: 5)] class InvokableListenerClassNoId { + public function __construct(public readonly string $val) {} + public function __invoke(CollectingEvent $event): void { $event->add(static::class); diff --git a/tests/OrderedListenerProviderServiceTest.php b/tests/OrderedListenerProviderServiceTest.php index cdb5a85..19eddc4 100644 --- a/tests/OrderedListenerProviderServiceTest.php +++ b/tests/OrderedListenerProviderServiceTest.php @@ -295,7 +295,7 @@ public function detects_invoke_method_and_type_with_class_attribute(): void public function detects_invoke_method_and_gives_class_id_by_default(): void { $container = new MockContainer(); - $container->addService(InvokableListenerClassNoId::class, new InvokableListenerClassNoId()); + $container->addService(InvokableListenerClassNoId::class, new InvokableListenerClassNoId('beep')); $provider = new OrderedListenerProvider($container);