function it_adds_exit_code_to_the_same_status()
 {
     $this->beConstructedWith(ExitStatus::EXECUTING);
     $otherStatus = new ExitStatus(ExitStatus::EXECUTING);
     $anotherStatus = new ExitStatus(ExitStatus::EXECUTING);
     $this->setExitCode($otherStatus->getExitCode());
     $this->getExitCode()->shouldReturn($otherStatus->getExitCode());
 }
Пример #2
0
 /**
  * Default mapping from throwable to {@link ExitStatus}. Clients can modify the exit code using a
  * {@link StepExecutionListener}.
  *
  * @param \Exception $e the cause of the failure
  *
  * @return ExitStatus {@link ExitStatus}
  */
 private function getDefaultExitStatusForFailure(\Exception $e)
 {
     if ($e instanceof JobInterruptedException || $e->getPrevious() instanceof JobInterruptedException) {
         $exitStatus = new ExitStatus(ExitStatus::STOPPED);
         $exitStatus->addExitDescription(get_class(new JobInterruptedException()));
     } else {
         $exitStatus = new ExitStatus(ExitStatus::FAILED);
         $exitStatus->addExitDescription($e);
     }
     return $exitStatus;
 }
Пример #3
0
 /**
  * @param ExitStatus $exitStatus
  *
  * @return JobExecution
  */
 public function setExitStatus(ExitStatus $exitStatus)
 {
     $this->exitStatus = $exitStatus;
     $this->exitCode = $exitStatus->getExitCode();
     $this->exitDescription = $exitStatus->getExitDescription();
     return $this;
 }