function it_throws_exception_when_serializer_is_not_a_normalizer(JobExecution $jobExecution, SerializerInterface $nonNormalizeSerializer, $exportExecution, $cleanExecution)
 {
     $this->setSerializer($nonNormalizeSerializer);
     $jobExecution->getStepExecutions()->willReturn([$exportExecution, $cleanExecution]);
     $jobExecution->getFailureExceptions()->willReturn([]);
     $jobExecution->getLabel()->willReturn('My Job');
     $this->shouldThrow(new \RuntimeException('Cannot normalize job execution of "My Job" because injected serializer is not a normalizer'))->duringNormalize($jobExecution, 'any');
 }
 /**
  * @param JobExecution $jobExecution
  */
 public function __construct(JobExecution $jobExecution)
 {
     $message = '';
     foreach ($jobExecution->getFailureExceptions() as $exception) {
         $message .= $this->getFailureExceptionMessage('JOB', $exception);
     }
     foreach ($jobExecution->getStepExecutions() as $stepExecution) {
         $message .= $this->getStepExecutionMessages($stepExecution);
     }
     parent::__construct($message);
 }
 function let(NotificationManager $manager, JobExecutionEvent $event, JobExecution $jobExecution, StepExecution $stepExecution, ArrayCollection $warnings, JobInstance $jobInstance, UserInterface $user, BatchStatus $status)
 {
     $this->beConstructedWith($manager);
     $jobExecution->getUser()->willReturn($user);
     $jobExecution->getStepExecutions()->willReturn([$stepExecution]);
     $jobExecution->getStatus()->willReturn($status);
     $jobExecution->getJobInstance()->willReturn($jobInstance);
     $stepExecution->getWarnings()->willReturn($warnings);
     $jobExecution->getId()->willReturn(5);
     $jobInstance->getType()->willReturn('export');
     $jobInstance->getLabel()->willReturn('Foo export');
     $event->getJobExecution()->willReturn($jobExecution);
 }
Пример #4
0
 /**
  * @param JobExecution $jobExecution
  * @return array
  */
 protected function collectErrors(JobExecution $jobExecution)
 {
     $errors = array();
     foreach ($jobExecution->getStepExecutions() as $stepExecution) {
         $errors = array_merge($errors, $this->contextRegistry->getByStepExecution($stepExecution)->getErrors());
     }
     return $errors;
 }
 /**
  * Returns true if the job has been executed without any warning
  *
  * @param JobExecution $jobExecution
  *
  * @return bool
  */
 protected function executionComplete(JobExecution $jobExecution)
 {
     if (ExitStatus::COMPLETED !== $jobExecution->getExitStatus()->getExitCode()) {
         return false;
     }
     foreach ($jobExecution->getStepExecutions() as $stepExecution) {
         if (count($stepExecution->getWarnings())) {
             return false;
         }
     }
     return true;
 }
 /**
  * {@inheritDoc}
  */
 public function getStepExecutions()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getStepExecutions', array());
     return parent::getStepExecutions();
 }