Skip to content

Commit 2e655fc

Browse files
author
Sergey Semenov
committed
MAGETWO-62947: Can't ignore errors during customer Import
1 parent 867c49b commit 2e655fc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\ImportExport\Controller\Adminhtml\Import;
77

88
use Magento\Framework\Filesystem\DirectoryList;
9+
use Magento\ImportExport\Model\Import;
10+
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
911

1012
/**
1113
* @magentoAppArea adminhtml
@@ -21,6 +23,8 @@ class ValidateTest extends \Magento\TestFramework\TestCase\AbstractBackendContro
2123
*/
2224
public function testValidationReturn($fileName, $message)
2325
{
26+
$validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR;
27+
2428
$this->getRequest()->setParam('isAjax', true);
2529
$this->getRequest()->setMethod('POST');
2630
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
@@ -30,6 +34,8 @@ public function testValidationReturn($fileName, $message)
3034
$this->getRequest()->setPostValue('form_key', $formKey->getFormKey());
3135
$this->getRequest()->setPostValue('entity', 'catalog_product');
3236
$this->getRequest()->setPostValue('behavior', 'append');
37+
$this->getRequest()->setPostValue(Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy);
38+
$this->getRequest()->setPostValue(Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0);
3339
$this->getRequest()->setPostValue('_import_field_separator', ',');
3440

3541
/** @var \Magento\TestFramework\App\Filesystem $filesystem */

dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\ImportExport\Model;
77

8-
use Magento\ImportExport\Model\Import;
8+
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
99

1010
/**
1111
* @magentoDataFixture Magento/ImportExport/_files/import_data.php
@@ -92,7 +92,7 @@ public function testImportSource()
9292

9393
$this->_model->setData(
9494
Import::FIELD_NAME_VALIDATION_STRATEGY,
95-
Import\ErrorProcessing\ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS
95+
ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS
9696
);
9797
$this->_model->importSource();
9898

@@ -105,7 +105,12 @@ public function testImportSource()
105105

106106
public function testValidateSource()
107107
{
108+
$validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR;
109+
108110
$this->_model->setEntity('catalog_product');
111+
$this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy);
112+
$this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0);
113+
109114
/** @var \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject $source */
110115
$source = $this->getMockForAbstractClass(
111116
\Magento\ImportExport\Model\Import\AbstractSource::class,

0 commit comments

Comments
 (0)