14
14
use PHPUnit \Framework \MockObject \MockObject ;
15
15
use PHPUnit \Framework \TestCase ;
16
16
use Symfony \Component \EventDispatcher \Event ;
17
+ use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
18
+ use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
17
19
use Symfony \Component \EventDispatcher \ImmutableEventDispatcher ;
18
20
19
21
/**
@@ -33,7 +35,7 @@ class ImmutableEventDispatcherTest extends TestCase
33
35
34
36
protected function setUp (): void
35
37
{
36
- $ this ->innerDispatcher = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventDispatcherInterface::class)-> getMock ( );
38
+ $ this ->innerDispatcher = $ this ->createMock ( EventDispatcherInterface::class);
37
39
$ this ->dispatcher = new ImmutableEventDispatcher ($ this ->innerDispatcher );
38
40
}
39
41
@@ -79,7 +81,7 @@ public function testAddListenerDisallowed()
79
81
public function testAddSubscriberDisallowed ()
80
82
{
81
83
$ this ->expectException (\BadMethodCallException::class);
82
- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
84
+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
83
85
84
86
$ this ->dispatcher ->addSubscriber ($ subscriber );
85
87
}
@@ -93,7 +95,7 @@ public function testRemoveListenerDisallowed()
93
95
public function testRemoveSubscriberDisallowed ()
94
96
{
95
97
$ this ->expectException (\BadMethodCallException::class);
96
- $ subscriber = $ this ->getMockBuilder (\ Symfony \ Component \ EventDispatcher \ EventSubscriberInterface::class)-> getMock ( );
98
+ $ subscriber = $ this ->createMock ( EventSubscriberInterface::class);
97
99
98
100
$ this ->dispatcher ->removeSubscriber ($ subscriber );
99
101
}
0 commit comments