ApiPlatform\Core\Tests\EventListener\AddFormatListenerTest::testSupportedRequestFormat PHP Method

testSupportedRequestFormat() public method

    public function testSupportedRequestFormat()
    {
        $request = new Request([], [], ['_api_resource_class' => 'Foo']);
        $request->setRequestFormat('xml');
        $eventProphecy = $this->prophesize(GetResponseEvent::class);
        $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled();
        $event = $eventProphecy->reveal();
        $listener = new AddFormatListener(new Negotiator(), ['xml' => ['text/xml']]);
        $listener->onKernelRequest($event);
        $this->assertSame('xml', $request->getRequestFormat());
        $this->assertSame('text/xml', $request->getMimeType($request->getRequestFormat()));
    }