@@ -23,16 +23,25 @@ public function testGetEventClassNameReturnsType()
23
23
{
24
24
$ eventObj = new DummyEvent ();
25
25
$ dispatcher = $ this ->createMock (EventDispatcherInterface::class);
26
+
27
+ $ listenersMap = [
28
+ 'someFunctionToSkip ' ,
29
+ [$ eventObj , 'methodNoArg ' ],
30
+ [$ eventObj , 'methodNoType ' ],
31
+ [$ eventObj , 'methodObjectType ' ],
32
+ [$ eventObj , 'methodWithType ' ],
33
+ ];
34
+
35
+ // less than PHP 7.2, unset object type-hint example
36
+ // otherwise, it looks like a class in this namespace
37
+ if (PHP_VERSION_ID < 70200 ) {
38
+ unset($ listenersMap [3 ]);
39
+ }
40
+
26
41
$ dispatcher ->expects ($ this ->once ())
27
42
->method ('getListeners ' )
28
43
->with ('foo.bar ' )
29
- ->willReturn ([
30
- 'someFunctionToSkip ' ,
31
- [$ eventObj , 'methodNoArg ' ],
32
- [$ eventObj , 'methodNoType ' ],
33
- [$ eventObj , 'methodObjectType ' ],
34
- [$ eventObj , 'methodWithType ' ],
35
- ]);
44
+ ->willReturn ($ listenersMap );
36
45
37
46
$ registry = new EventRegistry ($ dispatcher );
38
47
$ this ->assertSame (GetResponseForExceptionEvent::class, $ registry ->getEventClassName ('foo.bar ' ));
0 commit comments