/**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->controller = $this->createMock(ControllerInterface::class);
     $this->manager = $this->createMock(JobManagerInterface::class);
     $this->job = new Job();
     $this->job->setStatus(Status::REQUESTED());
     $this->manager->expects($this->any())->method('isManagerOf')->willReturn(true);
     $this->subject = new JobController($this->controller, $this->manager, $this->job);
 }
 /**
  * @param string             $type
  * @param Status             $status
  * @param array              $parameters
  * @param SchedulerInterface $schedule
  * @param mixed              $response
  * @return Job
  */
 public function createJob($type, $status = null, $parameters = null, $schedule = null, $response = null)
 {
     $job = new Job();
     $job->setType($type);
     $job->setParameters($parameters);
     $job->setResponse('JobResponse');
     if ($status != null) {
         $job->setStatus($status);
     }
     if ($schedule !== null) {
         $job->addSchedule($schedule);
     }
     return $job;
 }
 /**
  * @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;
 }
 /**
  * @param Status $status
  * @dataProvider provideStatusToSkip
  */
 public function testOnMessageSkipsExecutionIfStatusIs(Status $status)
 {
     $message = new Message('job-type', 'job-ticket');
     $job = new Job();
     $job->setType($message->getType());
     $job->setTicket($message->getTicket());
     $job->setStatus($status);
     $this->jobManager->expects($this->any())->method('findByTicket')->willReturn($job);
     $this->dispatcher->expects($this->never())->method('dispatch');
     $this->locker->expects($this->never())->method('lock');
     $this->subject->onMessage($message);
 }