Exemplo n.º 1
0
 public function testGetResponseWithSerializerException()
 {
     $job = new Job();
     $job->setType('JobType');
     $this->setProperty($job, 'serializedResponse', 'SerializedResponse');
     $this->serializationHelper->expects($this->any())->method('deserializeReturnValue')->willThrowException(new \Exception('Some deserialization error'));
     try {
         $job->getResponse();
     } catch (\Exception $e) {
         $this->assertNull($job->getResponse());
     }
 }
Exemplo n.º 2
0
 public function testHandlesResponseSerialization()
 {
     $type = 'foobar';
     $response = ['foo' => 'bar'];
     // persist object with parameters being an array
     $this->serializationHelper->expects($this->once())->method('serializeReturnValue')->with($type, $response)->willReturn('SerializedResponse');
     $job = $this->subject->create($type);
     $job->setStatus(Status::REQUESTED());
     $job->setResponse($response);
     $this->subject->save($job);
     $this->getEntityManager()->clear();
     $this->serializationHelper->expects($this->once())->method('deserializeReturnValue')->with($type, 'SerializedResponse')->willReturn($response);
     $persistedJob = $this->subject->findByTicket($job->getTicket());
     $this->assertEquals($response, $persistedJob->getResponse());
 }