Ejemplo n.º 1
0
 protected function setUp()
 {
     $this->contextRegistry = $this->getMockbuilder('Oro\\Bundle\\ImportExportBundle\\Context\\ContextRegistry')->disableOriginalConstructor()->getMock();
     $this->context = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface');
     $this->contextRegistry->expects($this->any())->method('getByStepExecution')->will($this->returnValue($this->context));
     $this->stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $this->reader = new ContextOptionReader($this->contextRegistry);
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Context key is missing
  */
 public function testReadFailed()
 {
     $reader = $this->getReader(null);
     /** @var \PHPUnit_Framework_MockObject_MockObject|StepExecution $stepExecution */
     $stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $context = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface');
     $this->contextRegistry->expects($this->once())->method('getByStepExecution')->with($stepExecution)->will($this->returnValue($context));
     $reader->setStepExecution($stepExecution);
 }
Ejemplo n.º 3
0
 public function testClassResolvedOnce()
 {
     /** @var StepExecution $stepExecution */
     $stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $context = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface');
     $context->expects($this->once())->method('getConfiguration')->will($this->returnValue(['entityName' => '\\stdClass']));
     $this->contextRegistry->expects($this->once())->method('getByStepExecution')->with($stepExecution)->will($this->returnValue($context));
     $this->writer->setStepExecution($stepExecution);
     $this->writer->write([]);
     // trigger detection twice
     $this->writer->write([]);
 }
Ejemplo n.º 4
0
 protected function setUp()
 {
     $this->contextRegistry = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextRegistry');
     $this->logger = new LoggerStrategy(new NullLogger());
     $this->contextMediator = $this->getMockBuilder('Oro\\Bundle\\IntegrationBundle\\Provider\\ConnectorContextMediator')->disableOriginalConstructor()->getMock();
     $this->stepExecutionMock = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $this->context = $this->getMock('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface');
     $this->contextRegistry->expects($this->any())->method('getByStepExecution')->will($this->returnValue($this->context));
     $channel = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Entity\\Channel');
     $transportSettings = $this->getMockForAbstractClass('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport');
     $channel->expects($this->any())->method('getTransport')->will($this->returnValue($transportSettings));
     $this->transport = $this->getMock('OroCRM\\Bundle\\MagentoBundle\\Provider\\Transport\\MagentoTransportInterface');
     $this->contextMediator->expects($this->any())->method('getInitializedTransport')->will($this->returnValue($this->transport));
     $this->contextMediator->expects($this->any())->method('getChannel')->will($this->returnValue($channel));
     $this->executionContext = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Item\\ExecutionContext');
     $this->jobExecution = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Entity\\JobExecution');
     $this->jobExecution->expects($this->any())->method('getExecutionContext')->will($this->returnValue($this->executionContext));
     $this->stepExecutionMock->expects($this->once())->method('getJobExecution')->will($this->returnValue($this->jobExecution));
 }
 public function testSetStepExecution()
 {
     $this->processor->setContextRegistry($this->contextRegistry);
     $this->contextRegistry->expects($this->once())->method('getByStepExecution')->will($this->returnValue($this->context));
     $this->processor->setStepExecution($this->stepExecution);
 }
Ejemplo n.º 6
0
 /**
  * @param mixed $context
  *
  * @return \PHPUnit_Framework_MockObject_MockObject+
  */
 protected function getMockStepExecution($context)
 {
     $stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $this->contextRegistry->expects($this->any())->method('getByStepExecution')->with($stepExecution)->will($this->returnValue($context));
     return $stepExecution;
 }