ApiPlatform\Core\Tests\EventListener\DeserializeListenerTest::testNoContentType PHP Method

testNoContentType() public method

public testNoContentType ( )
    public function testNoContentType()
    {
        $eventProphecy = $this->prophesize(GetResponseEvent::class);
        $request = new Request([], [], ['_api_resource_class' => 'Foo', '_api_collection_operation_name' => 'post'], [], [], [], '{}');
        $request->setMethod(Request::METHOD_POST);
        $request->setRequestFormat('unknown');
        $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled();
        $serializerProphecy = $this->prophesize(SerializerInterface::class);
        $serializerProphecy->deserialize()->shouldNotBeCalled();
        $serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class);
        $serializerContextBuilderProphecy->createFromRequest()->shouldNotBeCalled();
        $listener = new DeserializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal(), ['jsonld' => ['application/ld+json'], 'xml' => ['text/xml']]);
        $listener->onKernelRequest($eventProphecy->reveal());
    }