Skip to content

Commit 386cae8

Browse files
committed
ACP2E-1813: Scheduled import logs successful run despite the error
- implemented solution and adjusted existing unit tests
1 parent af9ab20 commit 386cae8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ public function importSource()
528528
$this->getErrorAggregator()->getInvalidRowsCount(),
529529
$this->getErrorAggregator()->getErrorsCount()
530530
),
531-
__('The import was successful.'),
531+
$this->getForceImport() == '0' && $this->getErrorAggregator()->getErrorsCount() > 0 ?
532+
__('The import was not successful.') : __('The import was successful.'),
532533
]
533534
);
534535
$this->importHistoryModel->updateReport($this, true);

app/code/Magento/ImportExport/Test/Unit/Model/ImportTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ protected function setUp(): void
268268
'_getEntityAdapter'
269269
]
270270
)
271+
->addMethods(['getForceImport'])
271272
->getMock();
272273
$this->setPropertyValue($this->import, '_varDirectory', $this->_varDirectory);
273274
}
@@ -302,6 +303,8 @@ public function testImportSource()
302303
$this->import->expects($this->any())
303304
->method('_getEntityAdapter')
304305
->willReturn($this->_entityAdapter);
306+
$this->import->expects($this->once())
307+
->method('getForceImport');
305308
$this->_importConfig
306309
->expects($this->any())
307310
->method('getEntities')

0 commit comments

Comments
 (0)