public function testDeserialize(string $method, bool $populateObject)
{
$result = $populateObject ? new \stdClass() : null;
$eventProphecy = $this->prophesize(GetResponseEvent::class);
$request = new Request([], [], ['data' => $result, '_api_resource_class' => 'Foo', '_api_collection_operation_name' => 'post'], [], [], [], '{}');
$request->setMethod($method);
$request->headers->set('Content-Type', 'application/json');
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled();
$serializerProphecy = $this->prophesize(SerializerInterface::class);
$context = $populateObject ? ['object_to_populate' => $populateObject] : [];
$serializerProphecy->deserialize('{}', 'Foo', 'json', $context)->willReturn($result)->shouldBeCalled();
$serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class);
$serializerContextBuilderProphecy->createFromRequest(Argument::type(Request::class), false, Argument::type('array'))->willReturn([])->shouldBeCalled();
$listener = new DeserializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal(), self::FORMATS);
$listener->onKernelRequest($eventProphecy->reveal());
}