Esempio n. 1
0
 /**
  * @dataProvider getDataWithSerializationProvider
  */
 public function testGetDataWithSerialization($data)
 {
     $isDataNull = is_null($data);
     $serializer = $this->getMockForAbstractClass('Symfony\\Component\\Serializer\\SerializerInterface');
     if (!$isDataNull && empty($data)) {
         $originalData = new ProcessData($data);
         $serializedData = $data;
         $serializer->expects($this->never())->method('deserialize');
     } else {
         $originalData = $isDataNull ? null : new ProcessData($data);
         $serializedData = 'serialized_data';
         $serializer->expects($this->exactly($isDataNull ? 2 : 1))->method('deserialize')->with($serializedData, 'Oro\\Bundle\\WorkflowBundle\\Model\\ProcessData', 'json')->will($this->returnValue($originalData));
     }
     $this->entity->setSerializer($serializer, 'json');
     $this->entity->setSerializedData($serializedData);
     $this->assertEquals($originalData, $this->entity->getData());
     $this->assertEquals($originalData, $this->entity->getData());
 }
 /**
  * Deserialize data of ProcessJob
  *
  * @param ProcessJob $processJob
  */
 protected function deserialize(ProcessJob $processJob)
 {
     // Pass serializer into ProcessJob to make lazy loading of entity item data.
     $processJob->setSerializer($this->serializer, $this->format);
 }