public function testDeserializeReturnValue() { $jobType = $this->createMock(JobTypeInterface::class); $this->registry->expects($this->once())->method('get')->with('JobType')->willReturn($jobType); $jobType->expects($this->once())->method('getReturnType')->willReturn('ReturnType'); $jobType->expects($this->once())->method('getReturnTypeOptions')->willReturn(['groups' => ['group1', 'group2'], 'version' => '12345']); $expectedContext = new DeserializationContext(); $expectedContext->setGroups(['group1', 'group2']); $expectedContext->setVersion('12345'); $this->serializer->expects($this->once())->method('deserialize')->with('ReturnValue', 'ReturnType', 'json', $expectedContext); $this->subject->deserializeReturnValue('JobType', 'ReturnValue'); }
/** * Deserializes the return of a job. * * @param string $type The job type * @param string $data * @return mixed */ public function deserializeReturnValue($type, $data) { $jobType = $this->registry->get($type); return $this->serializer->deserialize($data, $jobType->getReturnType(), 'json', $this->getResponseDeserializationContext($jobType)); }