コード例 #1
0
ファイル: Resource.php プロジェクト: sirdiego/importr
 /**
  * @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);
     }
 }
コード例 #2
0
ファイル: TargetTest.php プロジェクト: sirdiego/importr
 /**
  * @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);
 }