/**
  * @param Job    $expectedJob
  * @param string $data
  * @param array  $groups
  * @dataProvider provideSerializedJob
  */
 public function testDeserialization($expectedJob, $data, array $groups = [])
 {
     $context = null;
     if (count($groups) > 0) {
         $context = new DeserializationContext();
         $context->setGroups($groups);
     }
     $job = $this->serializer->deserialize($data, Job::class, 'json', $context);
     $this->assertEquals($expectedJob, $job);
 }
 /**
  * @param Request $request
  * @param array   $groups
  * @return JobInterface|mixed
  */
 protected function deserializeJob(Request $request, array $groups = [])
 {
     $context = null;
     if (count($groups) > 0) {
         $context = new DeserializationContext();
         $context->setGroups($groups);
     }
     return $this->getSerializer()->deserialize(json_encode($request->request->all(), true), Job::class, 'json', $context);
 }
 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');
 }