コード例 #1
0
 /**
  * @covers Gloubster\Message\Presence\WorkerPresence::getArrayData
  * @covers Gloubster\Message\AbstractMessage::toJson
  * @covers Gloubster\Message\AbstractMessage::fromJson
  */
 public function testFromToJson()
 {
     $type = 'worker-type';
     $this->object->setWorkerType($type);
     $total = mt_rand();
     $this->object->setFailureJobs($total);
     $id = mt_rand();
     $this->object->setId($id);
     $memory = 123456789;
     $this->object->setMemory($memory);
     $time = 223456789.98765433;
     $this->object->setStartedTime($time);
     $time = 333456789.9876543;
     $this->object->setLastJobTime($time);
     $total = mt_rand();
     $this->object->setTotalJobs($total);
     $success = mt_rand();
     $this->object->setSuccessJobs($success);
     $time = 444456789.98765445;
     $this->object->setReportTime($time);
     $idle = true;
     $this->object->setIdle($idle);
     $this->assertEquals($this->object, WorkerPresence::fromJson($this->object->toJson()));
 }