/** * @return Job */ public static function createJob($ticket = null, $type = null, $status = null, $processingTime = null, $parameters = null, array $schedules = array()) { $job = new Job(); $job->setTicket($ticket); $job->setType($type); $job->setParameters($parameters); $job->setProcessingTime($processingTime); foreach ($schedules as $schedule) { $job->addSchedule($schedule); } if ($status != null) { $job->setStatus($status); } return $job; }
public function testUpdateJobWithProcessingTimeIsNull() { $previousProcessingTime = (double) 0.5; $job = new Job(); $job->setProcessingTime($previousProcessingTime); $this->subject->updateJob($job, Status::PROCESSED()); $this->assertEquals($previousProcessingTime, $job->getProcessingTime()); }
public function testRestart() { $job = new Job(); $job->setTicket('JobTicket'); $job->setProcessingTime(500); $subject = $this->createMockedSubject(['add']); $this->jobManager->expects($this->once())->method('findByTicket')->with($job->getTicket())->willReturn($job); $subject->expects($this->once())->method('add')->with($job); $subject->restart($job->getTicket()); }