ApiPlatform\Core\Tests\EventListener\ExceptionListenerTest::testOnKernelException PHP Method

testOnKernelException() public method

public testOnKernelException ( Request $request )
$request Symfony\Component\HttpFoundation\Request
    public function testOnKernelException(Request $request)
    {
        $kernel = $this->prophesize(HttpKernelInterface::class);
        $kernel->handle(Argument::type(Request::class), HttpKernelInterface::SUB_REQUEST, false)->willReturn(new Response())->shouldBeCalled();
        $eventProphecy = $this->prophesize(GetResponseForExceptionEvent::class);
        $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled();
        $eventProphecy->getException()->willReturn(new \Exception())->shouldBeCalled();
        $eventProphecy->getKernel()->willReturn($kernel)->shouldBeCalled();
        $eventProphecy->setResponse(Argument::type(Response::class))->shouldBeCalled();
        $listener = new ExceptionListener('foo:bar');
        $listener->onKernelException($eventProphecy->reveal());
    }