/**
  * @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;
 }
예제 #2
0
 public function testUpdateJobWithProcessingTimeIsNull()
 {
     $previousProcessingTime = (double) 0.5;
     $job = new Job();
     $job->setProcessingTime($previousProcessingTime);
     $this->subject->updateJob($job, Status::PROCESSED());
     $this->assertEquals($previousProcessingTime, $job->getProcessingTime());
 }
예제 #3
0
 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());
 }