1414use PHPUnit \Framework \MockObject \MockObject ;
1515use PHPUnit \Framework \TestCase ;
1616use Symfony \Component \EventDispatcher \Event ;
17+ use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
18+ use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1719use Symfony \Component \EventDispatcher \ImmutableEventDispatcher ;
1820
1921/**
@@ -33,7 +35,7 @@ class ImmutableEventDispatcherTest extends TestCase
3335
3436 protected function setUp (): void
3537 {
36- $ this ->innerDispatcher = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventDispatcherInterface::class)-> getMock ( );
38+ $ this ->innerDispatcher = $ this ->createMock ( EventDispatcherInterface::class);
3739 $ this ->dispatcher = new ImmutableEventDispatcher ($ this ->innerDispatcher );
3840 }
3941
@@ -79,7 +81,7 @@ public function testAddListenerDisallowed()
7981 public function testAddSubscriberDisallowed ()
8082 {
8183 $ this ->expectException (\BadMethodCallException::class);
82- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
84+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
8385
8486 $ this ->dispatcher ->addSubscriber ($ subscriber );
8587 }
@@ -93,7 +95,7 @@ public function testRemoveListenerDisallowed()
9395 public function testRemoveSubscriberDisallowed ()
9496 {
9597 $ this ->expectException (\BadMethodCallException::class);
96- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
98+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
9799
98100 $ this ->dispatcher ->removeSubscriber ($ subscriber );
99101 }
0 commit comments