Exemple #1
0
 public function testPutJob()
 {
     $beanstalk = new Beanstalk();
     $beanstalk->useTube('test');
     $job = new Job();
     $job->setData(['foo' => 23, 'bar' => 42]);
     $this->assertNull($job->getId());
     $beanstalk->putJob($job);
     $this->assertNotNull($job->getId());
 }
Exemple #2
0
 /**
  * @param integer $length
  * @param integer $jobId
  * @return \Blar\Beanstalk\Job
  */
 protected function readJob($length, $jobId)
 {
     $job = new Job();
     $job->setBeanstalk($this);
     $job->setId($jobId);
     $job->setData(json_decode($this->readData($length)));
     return $job;
 }