/**
  * Preparing mock objects
  */
 protected function setUp()
 {
     $this->processingErrorFactoryMock = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingErrorFactory', ['create'], [], '', false);
     $this->processingErrorMock1 = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingError', null, [], '', false);
     $this->processingErrorMock2 = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingError', null, [], '', false);
     $this->processingErrorMock3 = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingError', null, [], '', false);
     $this->processingErrorFactoryMock->expects($this->any())->method('create')->willReturnOnConsecutiveCalls($this->processingErrorMock1, $this->processingErrorMock2, $this->processingErrorMock3);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->model = $objectManager->getObject('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingErrorAggregator', ['errorFactory' => $this->processingErrorFactoryMock]);
 }
 /**
  * @param string $errorCode
  * @param string $errorLevel
  * @param int|null $rowNumber
  * @param string|null $columnName
  * @param string|null $errorMessage
  * @param string|null $errorDescription
  * @return $this
  */
 public function addError($errorCode, $errorLevel = ProcessingError::ERROR_LEVEL_CRITICAL, $rowNumber = null, $columnName = null, $errorMessage = null, $errorDescription = null)
 {
     if ($this->isErrorAlreadyAdded($rowNumber, $errorCode)) {
         return $this;
     }
     $this->processErrorStatistics($errorLevel);
     $this->processInvalidRow($rowNumber);
     $errorMessage = $this->getErrorMessage($errorCode, $errorMessage, $columnName);
     /** @var ProcessingError $newError */
     $newError = $this->errorFactory->create();
     $newError->init($errorCode, $errorLevel, $rowNumber, $columnName, $errorMessage, $errorDescription);
     $this->items[] = $newError;
     return $this;
 }
 protected function setUp()
 {
     $translateInline = $this->getMock('\\Magento\\Framework\\Translate\\InlineInterface', [], [], '', false);
     $translateInline->expects($this->any())->method('isAllowed')->will($this->returnValue(false));
     $context = $this->getMock('Magento\\Framework\\App\\Helper\\Context', ['getTranslateInline'], [], '', false);
     $context->expects($this->any())->method('getTranslateInline')->will($this->returnValue($translateInline));
     $this->_string = new \Magento\Framework\Stdlib\StringUtils();
     $this->_importFactory = $this->getMock('Magento\\ImportExport\\Model\\ImportFactory', [], [], '', false);
     $this->_resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->_resourceHelper = $this->getMock('Magento\\ImportExport\\Model\\ResourceModel\\Helper', [], [], '', false);
     $this->_dataFactory = $this->getMock('Magento\\CustomerImportExport\\Model\\ResourceModel\\Import\\CustomerComposite\\DataFactory', [], [], '', false);
     $this->_customerFactory = $this->getMock('Magento\\CustomerImportExport\\Model\\Import\\CustomerFactory', [], [], '', false);
     $this->_addressFactory = $this->getMock('Magento\\CustomerImportExport\\Model\\Import\\AddressFactory', [], [], '', false);
     $this->errorFactory = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingErrorFactory', ['create'], [], '', false);
     $this->error = $this->getMock('\\Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingError', ['init'], [], '', false);
     $this->errorFactory->expects($this->any())->method('create')->will($this->returnValue($this->error));
     $this->error->expects($this->any())->method('init')->will($this->returnValue(true));
     $this->errorAggregator = $this->getMock('Magento\\ImportExport\\Model\\Import\\ErrorProcessing\\ProcessingErrorAggregator', ['hasToBeTerminated'], [$this->errorFactory], '', true);
     $this->_scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
 }