Ejemplo n.º 1
0
 /**
  * @param TargetInterface $target
  * @param mixed $entry
  * @param Import $import
  * @param int $pointer
  *
  * @throws \Exception
  */
 public function process(TargetInterface $target, $entry, Import $import, $pointer)
 {
     try {
         $entry = $this->emitEntrySignal('preProcess', $target->getConfiguration(), $entry);
         $result = $target->processEntry($entry);
         $import->increaseCount($result);
     } catch (\Exception $e) {
         $import->increaseCount(TargetInterface::RESULT_ERROR);
         $this->importService->updateImport($import, $pointer + 1);
         throw $e;
     }
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function do_all_increases_work_correctly()
 {
     $types = [TargetInterface::RESULT_INSERT => 'getInserted', TargetInterface::RESULT_UPDATE => 'getUpdated', TargetInterface::RESULT_IGNORED => 'getIgnored', TargetInterface::RESULT_UNSURE => 'getUnknowns', TargetInterface::RESULT_ERROR => 'getErrors'];
     foreach ($types as $type => $getter) {
         $import = new Import();
         $import->increaseCount($type);
         $this->assertEquals(1, $import->{$getter}());
     }
 }