| @@ 107-124 (lines=18) @@ | ||
| 104 | * @expectedException \InvalidArgumentException |
|
| 105 | * @expectedExceptionMessage Context key is missing |
|
| 106 | */ |
|
| 107 | public function testReadFailed() |
|
| 108 | { |
|
| 109 | $reader = $this->getReader(null); |
|
| 110 | ||
| 111 | /** @var \PHPUnit_Framework_MockObject_MockObject|StepExecution $stepExecution */ |
|
| 112 | $stepExecution = $this->getMockBuilder('Akeneo\Bundle\BatchBundle\Entity\StepExecution') |
|
| 113 | ->disableOriginalConstructor() |
|
| 114 | ->getMock(); |
|
| 115 | ||
| 116 | $context = $this->getMock('Oro\Bundle\ImportExportBundle\Context\ContextInterface'); |
|
| 117 | ||
| 118 | $this->contextRegistry->expects($this->once()) |
|
| 119 | ->method('getByStepExecution') |
|
| 120 | ->with($stepExecution) |
|
| 121 | ->will($this->returnValue($context)); |
|
| 122 | ||
| 123 | $reader->setStepExecution($stepExecution); |
|
| 124 | } |
|
| 125 | } |
|
| 126 | ||
| @@ 119-129 (lines=11) @@ | ||
| 116 | ]; |
|
| 117 | } |
|
| 118 | ||
| 119 | public function testSetStepExecutionSetToWrappedWriter() |
|
| 120 | { |
|
| 121 | $wrapped = $this->getMock('OroCRM\Bundle\MagentoBundle\Tests\Unit\Stub\StepExecutionAwareWriter'); |
|
| 122 | $writer = new ProxyEntityWriter($wrapped, $this->databaseHelper); |
|
| 123 | $stepExecution = $this->getMockBuilder('Akeneo\Bundle\BatchBundle\Entity\StepExecution') |
|
| 124 | ->disableOriginalConstructor()->getMock(); |
|
| 125 | $wrapped->expects($this->once())->method('setStepExecution') |
|
| 126 | ->with($this->equalTo($stepExecution)); |
|
| 127 | ||
| 128 | $writer->setStepExecution($stepExecution); |
|
| 129 | } |
|
| 130 | ||
| 131 | public function testSetStepExecutionDoesNotProvokeErrorWithRegularWriter() |
|
| 132 | { |
|