Example #1
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 an {@link ExitStatus}
  */
 private function getDefaultExitStatusForFailure(\Exception $e)
 {
     $exitStatus = new ExitStatus();
     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;
 }
 public function testAddExitDescriptionToExistingDescription()
 {
     $status = new ExitStatus(ExitStatus::EXECUTING);
     $status->addExitDescription("Foo");
     $status->addExitDescription("Bar");
     $this->assertEquals("Foo;Bar", $status->getExitDescription());
 }