@@ -35,9 +35,10 @@ public function testOnKernelException(Request $request)
3535 $ kernel ->handle (Argument::type (Request::class), HttpKernelInterface::SUB_REQUEST , false )->willReturn (new Response ())->shouldBeCalled ();
3636
3737 $ 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 );
4142 $ eventProphecy ->setResponse (Argument::type (Response::class))->shouldBeCalled ();
4243
4344 $ listener = new ExceptionListener ('foo:bar ' );
@@ -55,7 +56,8 @@ public function getRequest()
5556 public function testDoNothingWhenNotAnApiCall ()
5657 {
5758 $ 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 ();
5961
6062 $ listener = new ExceptionListener ('foo:bar ' );
6163 $ listener ->onKernelException ($ eventProphecy ->reveal ());
@@ -67,7 +69,8 @@ public function testDoNothingWhenHtmlRequested()
6769 $ request ->setRequestFormat ('html ' );
6870
6971 $ eventProphecy = $ this ->prophesize (GetResponseForExceptionEvent::class);
70- $ eventProphecy ->getRequest ()->willReturn ($ request )->shouldBeCalled ();
72+ $ eventProphecy ->getRequest ()->willReturn ($ request );
73+ $ eventProphecy ->setResponse (Argument::type (Response::class))->shouldNotBeCalled ();
7174
7275 $ listener = new ExceptionListener ('foo:bar ' );
7376 $ listener ->onKernelException ($ eventProphecy ->reveal ());
0 commit comments