protected function setUp() { $this->executor = new PostProcessStepExecutor(); $this->jobExecutor = $this->getMockBuilder('Oro\\Bundle\\ImportExportBundle\\Job\\JobExecutor')->disableOriginalConstructor()->getMock(); $this->executor->setJobExecutor($this->jobExecutor); $this->reader = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Item\\ItemReaderInterface'); $this->executor->setReader($this->reader); $this->processor = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Item\\ItemProcessorInterface'); $this->executor->setProcessor($this->processor); $this->writer = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Item\\ItemWriterInterface'); $this->executor->setWriter($this->writer); $this->executor->setBatchSize(2); }
/** * {@inheritdoc} */ public function doExecute(StepExecution $stepExecution) { $this->initializeStepElements($stepExecution); $stepExecutor = new PostProcessStepExecutor(); $stepExecutor->setStepExecution($stepExecution)->setJobExecutor($this->jobExecutor)->setReader($this->reader)->setProcessor($this->processor)->setWriter($this->writer); if (null !== $this->batchSize) { $stepExecutor->setBatchSize($this->batchSize); } if ($this->contextSharedKeys) { $stepExecutor->setContextSharedKeys($this->contextSharedKeys); } if ($this->postProcessingJobs) { $jobType = $stepExecution->getJobExecution()->getJobInstance()->getType(); foreach ($this->postProcessingJobs as $jobName) { $stepExecutor->addPostProcessingJob($jobType, $jobName); } } $stepExecutor->execute($this); $this->flushStepElements(); }