File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/Symfony/Bundle/FrameworkBundle/Tests/Debug Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -27,4 +27,24 @@ public function testThrowsAnExceptionWhenAListenerMethodIsNotCallable()
27
27
$ dispatcher = new TraceableEventDispatcher ($ container , new Stopwatch ());
28
28
$ dispatcher ->addListener ('onFooEvent ' , new \stdClass ());
29
29
}
30
+
31
+ public function testClosureDoesNotTriggerErrorNotice ()
32
+ {
33
+ $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerInterface ' );
34
+ $ dispatcher = new TraceableEventDispatcher ($ container , new StopWatch ());
35
+ $ triggered = false ;
36
+
37
+ $ dispatcher ->addListener ('onFooEvent ' , function () use (&$ triggered ) {
38
+ $ triggered = true ;
39
+ });
40
+
41
+ try {
42
+ $ dispatcher ->dispatch ('onFooEvent ' );
43
+ } catch (\PHPUnit_Framework_Error_Notice $ e ) {
44
+ $ this ->fail ($ e ->getMessage ());
45
+ }
46
+
47
+ $ this ->assertTrue ($ triggered , 'Closure should have been executed upon dispatch ' );
48
+ }
49
+
30
50
}
You can’t perform that action at this time.
0 commit comments