Skip to content

Commit 3d6e1cc

Browse files
author
Yaroslav Onischenko
committed
MAGETWO-43900: Imported products with broken images link don't appear on front
1 parent 44deef8 commit 3d6e1cc

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public function addError(
8181
return $this;
8282
}
8383
$this->processErrorStatistics($errorLevel);
84-
$this->processInvalidRow($rowNumber);
84+
if ($errorLevel == ProcessingError::ERROR_LEVEL_CRITICAL) {
85+
$this->processInvalidRow($rowNumber);
86+
}
8587
$errorMessage = $this->getErrorMessage($errorCode, $errorMessage, $columnName);
8688

8789
/** @var ProcessingError $newError */

app/code/Magento/ImportExport/Test/Unit/Model/Import/ErrorProcessing/ProcessingErrorAggregatorTest.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\ImportExport\Test\Unit\Model\Import\ErrorProcessing;
77

8+
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingError;
9+
810
class ProcessingErrorAggregatorTest extends \PHPUnit_Framework_TestCase
911
{
1012
/**
@@ -124,22 +126,26 @@ public function testAddErrorMessageTemplate()
124126

125127
/**
126128
* Test for method isRowInvalid. Expected true result.
129+
* @dataProvider isRowInvalidDataProvider
127130
*/
128-
public function testIsRowInvalidTrue()
131+
public function testIsRowInvalid($errorLevel, $rowNumber, $isValid)
129132
{
130-
$this->model->addError('systemException', 'critical', 7, 'Some column name', 'Message', 'Description');
131-
$result = $this->model->isRowInvalid(7);
132-
$this->assertTrue($result);
133+
$this->model->addError('systemException', $errorLevel, $rowNumber, 'Some column name', 'Message', 'Description');
134+
$result = $this->model->isRowInvalid($rowNumber);
135+
$this->assertEquals($isValid, $result);
133136
}
134137

135138
/**
136-
* Test for method isRowInvalid. Expected false result.
139+
* @return array
137140
*/
138-
public function testIsRowInvalidFalse()
141+
public function isRowInvalidDataProvider()
139142
{
140-
$this->model->addError('systemException');
141-
$result = $this->model->isRowInvalid(8);
142-
$this->assertFalse($result);
143+
return [
144+
[ProcessingError::ERROR_LEVEL_CRITICAL, 7, true],
145+
[ProcessingError::ERROR_LEVEL_NOT_CRITICAL, 8, false],
146+
[ProcessingError::ERROR_LEVEL_NOTICE, 9, false],
147+
[ProcessingError::ERROR_LEVEL_WARNING, 10, false]
148+
];
143149
}
144150

145151
/**

0 commit comments

Comments
 (0)