/** * @inheritdoc */ public function put(JobInterface $job) { if ($this->scheduler->shouldBeScheduled($job->getDelay())) { return $this->scheduler->store($job); } else { return $this->beanstalk->useTube($job->getQueue())->put(JobFactory::serializeBody($job), $job->getPriority(), $job->getDelay(), $job->getTtr()); } }
/** * @param mixed $jobData * @dataProvider jobDataMaintainsExpectedTypeDataProvider */ public function testJobDataMaintainsExpectedType($jobData) { $package = JobFactory::serializeBody(new Job('TestQueue', $jobData)); $this->beanstalk->expects($this->any())->method('reserve')->will($this->returnValue(['id' => 234, 'body' => $package])); $job = $this->jobQueue->retrieve('TestQueue'); $this->assertEquals($jobData, $job->getBody()); }