@@ -35,9 +35,10 @@ public function testOnKernelException(Request $request)
35
35
$ kernel ->handle (Argument::type (Request::class), HttpKernelInterface::SUB_REQUEST , false )->willReturn (new Response ())->shouldBeCalled ();
36
36
37
37
$ eventProphecy = $ this ->prophesize (GetResponseForExceptionEvent::class);
38
- $ eventProphecy ->getRequest ()->willReturn ($ request )->shouldBeCalled ();
39
- $ eventProphecy ->getException ()->willReturn (new \Exception ())->shouldBeCalled ();
40
- $ eventProphecy ->getKernel ()->willReturn ($ kernel )->shouldBeCalled ();
38
+ $ eventProphecy ->getRequest ()->willReturn ($ request );
39
+ $ eventProphecy ->getException ()->willReturn (new \Exception ());
40
+ $ eventProphecy ->setException (Argument::type (\Exception::class))->will (function () {});
41
+ $ eventProphecy ->getKernel ()->willReturn ($ kernel );
41
42
$ eventProphecy ->setResponse (Argument::type (Response::class))->shouldBeCalled ();
42
43
43
44
$ listener = new ExceptionListener ('foo:bar ' );
@@ -55,7 +56,8 @@ public function getRequest()
55
56
public function testDoNothingWhenNotAnApiCall ()
56
57
{
57
58
$ eventProphecy = $ this ->prophesize (GetResponseForExceptionEvent::class);
58
- $ eventProphecy ->getRequest ()->willReturn (new Request ())->shouldBeCalled ();
59
+ $ eventProphecy ->getRequest ()->willReturn (new Request ());
60
+ $ eventProphecy ->setResponse (Argument::type (Response::class))->shouldNotBeCalled ();
59
61
60
62
$ listener = new ExceptionListener ('foo:bar ' );
61
63
$ listener ->onKernelException ($ eventProphecy ->reveal ());
@@ -67,7 +69,8 @@ public function testDoNothingWhenHtmlRequested()
67
69
$ request ->setRequestFormat ('html ' );
68
70
69
71
$ eventProphecy = $ this ->prophesize (GetResponseForExceptionEvent::class);
70
- $ eventProphecy ->getRequest ()->willReturn ($ request )->shouldBeCalled ();
72
+ $ eventProphecy ->getRequest ()->willReturn ($ request );
73
+ $ eventProphecy ->setResponse (Argument::type (Response::class))->shouldNotBeCalled ();
71
74
72
75
$ listener = new ExceptionListener ('foo:bar ' );
73
76
$ listener ->onKernelException ($ eventProphecy ->reveal ());
0 commit comments