99use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \Auto \AutoEvent1 ;
1010use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \Auto \AutoEvent2 ;
1111use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \Auto \AutoEvent3 ;
12+ use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \Auto \AutoEventSubscriberUsingInvoke ;
13+ use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \Auto \AutoEventSubscriberUsingPublicMethod ;
1214use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \TestCommand ;
1315use SimpleBus \SymfonyBridge \Tests \Functional \SmokeTest \TestKernel ;
1416use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
@@ -68,14 +70,13 @@ public function it_can_auto_register_event_subscribers_using_invoke()
6870 self ::bootKernel (['environment ' => 'config2 ' ]);
6971 $ container = self ::$ kernel ->getContainer ();
7072
71- $ subscriber = $ container ->get ('auto_event_subscriber_using_invoke ' );
7273 $ event = new AutoEvent1 ();
7374
74- $ this ->assertNull ( $ subscriber -> handled );
75+ $ this ->assertFalse ( $ event -> isHandledBy (AutoEventSubscriberUsingInvoke::class) );
7576
7677 $ container ->get ('event_bus ' )->handle ($ event );
7778
78- $ this ->assertSame ($ event, $ subscriber -> handled );
79+ $ this ->assertTrue ($ event-> isHandledBy (AutoEventSubscriberUsingInvoke::class) );
7980 }
8081
8182 /**
@@ -86,16 +87,17 @@ public function it_can_auto_register_event_subscribers_using_public_method()
8687 self ::bootKernel (['environment ' => 'config2 ' ]);
8788 $ container = self ::$ kernel ->getContainer ();
8889
89- $ subscriber = $ container ->get ('auto_event_subscriber_using_public_method ' );
9090 $ event2 = new AutoEvent2 ();
9191 $ event3 = new AutoEvent3 ();
9292
93- $ this ->assertEmpty ($ subscriber ->handled );
93+ $ this ->assertFalse ($ event2 ->isHandledBy (AutoEventSubscriberUsingPublicMethod::class));
94+ $ this ->assertFalse ($ event3 ->isHandledBy (AutoEventSubscriberUsingPublicMethod::class));
9495
9596 $ container ->get ('event_bus ' )->handle ($ event2 );
9697 $ container ->get ('event_bus ' )->handle ($ event3 );
9798
98- $ this ->assertSame ([$ event2 , $ event3 ], $ subscriber ->handled );
99+ $ this ->assertTrue ($ event2 ->isHandledBy (AutoEventSubscriberUsingPublicMethod::class));
100+ $ this ->assertTrue ($ event3 ->isHandledBy (AutoEventSubscriberUsingPublicMethod::class));
99101 }
100102
101103 /**
@@ -106,14 +108,13 @@ public function it_can_auto_register_command_handlers_using_invoke()
106108 self ::bootKernel (['environment ' => 'config2 ' ]);
107109 $ container = self ::$ kernel ->getContainer ();
108110
109- $ handler = $ container ->get ('auto_command_handler_using_invoke ' );
110111 $ command = new AutoCommand1 ();
111112
112- $ this ->assertNull ( $ handler -> handled );
113+ $ this ->assertFalse ( $ command -> isHandled () );
113114
114115 $ container ->get ('command_bus ' )->handle ($ command );
115116
116- $ this ->assertSame ($ command, $ handler -> handled );
117+ $ this ->assertTrue ($ command-> isHandled () );
117118 }
118119
119120 /**
@@ -124,14 +125,13 @@ public function it_can_auto_register_command_handlers_using_public_method()
124125 self ::bootKernel (['environment ' => 'config2 ' ]);
125126 $ container = self ::$ kernel ->getContainer ();
126127
127- $ handler = $ container ->get ('auto_command_handler_using_public_method ' );
128128 $ command = new AutoCommand2 ();
129129
130- $ this ->assertNull ( $ handler -> handled );
130+ $ this ->assertFalse ( $ command -> isHandled () );
131131
132132 $ container ->get ('command_bus ' )->handle ($ command );
133133
134- $ this ->assertSame ($ command, $ handler -> handled );
134+ $ this ->assertTrue ($ command-> isHandled () );
135135 }
136136
137137 /**
0 commit comments