/** * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @expectedExceptionMessage Not Found */ public function testInvalidRouteFormat() { $request = new Request([], [], ['_api_resource_class' => 'Foo', '_format' => 'invalid']); $eventProphecy = $this->prophesize(GetResponseEvent::class); $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); $event = $eventProphecy->reveal(); $listener = new AddFormatListener(new Negotiator(), ['json' => ['application/json']]); $listener->onKernelRequest($event); }