ApiPlatform\Core\Tests\EventListener\SerializeListenerTest::testDoNotSerializeWhenResourceClassNotSet PHP Method

testDoNotSerializeWhenResourceClassNotSet() public method

    public function testDoNotSerializeWhenResourceClassNotSet()
    {
        $serializerProphecy = $this->prophesize(SerializerInterface::class);
        $serializerProphecy->serialize()->shouldNotBeCalled();
        $request = new Request([], [], ['_api_collection_operation_name' => 'get']);
        $request->setRequestFormat('xml');
        $eventProphecy = $this->prophesize(GetResponseForControllerResultEvent::class);
        $eventProphecy->getControllerResult()->willReturn(new \stdClass())->shouldBeCalled();
        $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled();
        $serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class);
        $serializerContextBuilderProphecy->createFromRequest()->shouldNotBeCalled();
        $listener = new SerializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal());
        $listener->onKernelView($eventProphecy->reveal());
    }