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

testDoNotSerializeWhenOperationNotSet() public method

    public function testDoNotSerializeWhenOperationNotSet()
    {
        $serializerProphecy = $this->prophesize(SerializerInterface::class);
        $serializerProphecy->serialize()->shouldNotBeCalled();
        $request = new Request([], [], ['_api_resource_class' => 'Foo']);
        $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());
    }