1313
1414use PHPUnit \Framework \MockObject \MockObject ;
1515use PHPUnit \Framework \TestCase ;
16+ use Symfony \Component \EventDispatcher \Event ;
17+ use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
18+ use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1619use Symfony \Component \EventDispatcher \ImmutableEventDispatcher ;
1720use Symfony \Contracts \EventDispatcher \Event ;
1821
@@ -33,7 +36,7 @@ class ImmutableEventDispatcherTest extends TestCase
3336
3437 protected function setUp (): void
3538 {
36- $ this ->innerDispatcher = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventDispatcherInterface::class)-> getMock ( );
39+ $ this ->innerDispatcher = $ this ->createMock ( EventDispatcherInterface::class);
3740 $ this ->dispatcher = new ImmutableEventDispatcher ($ this ->innerDispatcher );
3841 }
3942
@@ -79,7 +82,7 @@ public function testAddListenerDisallowed()
7982 public function testAddSubscriberDisallowed ()
8083 {
8184 $ this ->expectException (\BadMethodCallException::class);
82- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
85+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
8386
8487 $ this ->dispatcher ->addSubscriber ($ subscriber );
8588 }
@@ -93,7 +96,7 @@ public function testRemoveListenerDisallowed()
9396 public function testRemoveSubscriberDisallowed ()
9497 {
9598 $ this ->expectException (\BadMethodCallException::class);
96- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
99+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
97100
98101 $ this ->dispatcher ->removeSubscriber ($ subscriber );
99102 }
0 commit comments