/**
  * @param ProcessingErrorAggregatorInterface $errorAggregator
  * @return string
  */
 protected function createErrorReport(ProcessingErrorAggregatorInterface $errorAggregator)
 {
     $this->historyModel->loadLastInsertItem();
     $sourceFile = $this->reportHelper->getReportAbsolutePath($this->historyModel->getImportedFile());
     $writeOnlyErrorItems = true;
     if ($this->historyModel->getData('execution_time') == ModelHistory::IMPORT_VALIDATION) {
         $writeOnlyErrorItems = false;
     }
     $fileName = $this->reportProcessor->createReport($sourceFile, $errorAggregator, $writeOnlyErrorItems);
     $this->historyModel->addErrorReportFile($fileName);
     return $fileName;
 }
 /**
  * Cover createHistoryReport().
  */
 public function testCreateHistoryReportExtensionIsSet()
 {
     $sourceFileRelative = 'not array';
     $entity = 'entity value';
     $extension = 'extension value';
     $result = [];
     $fileName = $entity . $extension;
     $gmtTimestamp = 1234567;
     $copyName = $gmtTimestamp . '_' . $fileName;
     $this->import->expects($this->once())->method('isReportEntityType')->with($entity)->willReturn(true);
     $this->_varDirectory->expects($this->never())->method('getRelativePath');
     $this->dateTime->expects($this->once())->method('gmtTimestamp')->willReturn($gmtTimestamp);
     $this->historyModel->expects($this->once())->method('addReport')->with($copyName);
     $args = [$sourceFileRelative, $entity, $extension, $result];
     $actualResult = $this->invokeMethod($this->import, 'createHistoryReport', $args);
     $this->assertEquals($this->import, $actualResult);
 }