Ejemplo n.º 1
0
 /**
  * @test
  */
 public function updates_current_import_status()
 {
     $import = $this->getMock(Import::class);
     $import->expects($this->once())->method('getFilepath')->will($this->returnValue('./import.csv'));
     $import->expects($this->once())->method('getPointer')->will($this->returnValue(1));
     $import->expects($this->exactly(2))->method('getAmount')->will($this->returnValue(2));
     $this->service->expects($this->exactly(3))->method('updateImport')->withConsecutive([$import], [$import, 2], [$import, 2]);
     $resource = $this->getMock(ResourceInterface::class);
     $resource->expects($this->once())->method('getFilepathExpression')->will($this->returnValue('/\\.csv$/'));
     $manager = $this->getMock(ManagerInterface::class);
     $manager->expects($this->any())->method('getUpdateInterval')->will($this->returnValue(2));
     $target = $this->getMock(TargetInterface::class);
     $result = $this->fixture->process($import, [$target], [], $resource, $manager);
 }
Ejemplo n.º 2
0
 /**
  * Magic Runner
  *
  * @param \HDNET\Importr\Domain\Model\Import $import
  */
 protected function runImport(Import $import)
 {
     $this->emitSignal('preImport', $import);
     $resources = $this->initializeResourcesByImport($import);
     $targets = $this->initializeTargets($import);
     $strategyConfiguration = $import->getStrategy()->getConfiguration();
     foreach ($resources as $resource) {
         if ($this->resource->process($import, $targets, $strategyConfiguration, $resource, $this)) {
             break;
         }
     }
     $this->emitSignal('postImport', $import);
 }