/** * @param ResourceInterface $resource * @param int $pointer * @param array $targets * @param Import $import */ protected function processOneLine(ResourceInterface $resource, $pointer, array $targets, Import $import) { $entry = $resource->getEntry($pointer); foreach ($targets as $target) { $this->target->process($target, $entry, $import, $pointer); } }
/** * @test * @expectedException \Exception */ public function processWithException() { $entry = []; /** @var \PHPUnit_Framework_MockObject_MockObject|TargetInterface $target */ $target = $this->getMockBuilder(TargetInterface::class)->getMock(); $target->expects($this->once())->method('processEntry')->with($this->equalTo($entry))->will($this->throwException(new \Exception())); $target->expects($this->any())->method('getConfiguration')->will($this->returnValue([])); /** @var \PHPUnit_Framework_MockObject_MockObject|Import $import */ $import = $this->getMockBuilder(Import::class)->getMock(); $import->expects($this->once())->method('increaseCount')->with($this->equalTo(TargetInterface::RESULT_ERROR)); $pointer = 1; $this->fixture->process($target, $entry, $import, $pointer); }