function it_injects_the_configuration_in_steps(StepInterface $stepOne, StepInterface $stepTwo) { $this->setSteps([$stepOne, $stepTwo]); $stepOne->setConfiguration(['conf1A' => 'value1A', 'conf2' => 'value2'])->shouldBeCalled(); $stepTwo->setConfiguration(['conf1A' => 'value1A', 'conf2' => 'value2'])->shouldBeCalled(); $this->setConfiguration(['conf1A' => 'value1A', 'conf2' => 'value2']); }
/** * Handle a step and return the execution for it. * @param StepInterface $step Step * @param JobExecution $jobExecution Job execution * * @throws JobInterruptedException * * @return StepExecution */ protected function handleStep(StepInterface $step, JobExecution $jobExecution) { if ($jobExecution->isStopping()) { throw new JobInterruptedException("JobExecution interrupted."); } $stepExecution = $jobExecution->createStepExecution($step->getName()); try { $step->setJobRepository($this->jobRepository); $step->execute($stepExecution); } catch (JobInterruptedException $e) { $stepExecution->setStatus(new BatchStatus(BatchStatus::STOPPING)); $this->jobRepository->updateStepExecution($stepExecution); throw $e; } if ($stepExecution->getStatus()->getValue() == BatchStatus::STOPPING || $stepExecution->getStatus()->getValue() == BatchStatus::STOPPED) { $jobExecution->setStatus(new BatchStatus(BatchStatus::STOPPING)); $this->jobRepository->updateJobExecution($jobExecution); throw new JobInterruptedException("Job interrupted by step execution"); } return $stepExecution; }