File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
app/code/Magento/ImportExport/Model
dev/tests/integration/testsuite/Magento/ImportExport/Model Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,6 @@ public function validateSource(\Magento\ImportExport\Model\Import\AbstractSource
567567 ProcessingError::ERROR_LEVEL_CRITICAL ,
568568 null ,
569569 null ,
570- null ,
571570 $ e ->getMessage ()
572571 );
573572 }
Original file line number Diff line number Diff line change @@ -135,6 +135,31 @@ public function testValidateSourceException()
135135 $ this ->_model ->validateSource ($ source );
136136 }
137137
138+ public function testValidateSourceExceptionMessage ()
139+ {
140+ $ exceptionMessage = 'Test Exception Message. ' ;
141+
142+ $ validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR ;
143+ $ this ->_model ->setEntity ('catalog_product ' );
144+ $ this ->_model ->setData (\Magento \ImportExport \Model \Import::FIELD_NAME_VALIDATION_STRATEGY , $ validationStrategy );
145+ $ this ->_model ->setData (\Magento \ImportExport \Model \Import::FIELD_NAME_ALLOWED_ERROR_COUNT , 0 );
146+
147+ /** @var \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject $source */
148+ $ source = $ this ->getMockForAbstractClass (
149+ \Magento \ImportExport \Model \Import \AbstractSource::class,
150+ [['sku ' , 'name ' ]]
151+ );
152+ $ source ->expects ($ this ->any ())->method ('_getNextRow ' )->willThrowException (
153+ new \Exception ($ exceptionMessage )
154+ );
155+
156+ $ this ->assertFalse ($ this ->_model ->validateSource ($ source ));
157+ $ this ->assertEquals (
158+ $ exceptionMessage ,
159+ $ this ->_model ->getErrorAggregator ()->getAllErrors ()[0 ]->getErrorMessage ()
160+ );
161+ }
162+
138163 public function testGetEntity ()
139164 {
140165 $ entityName = 'entity_name ' ;
You can’t perform that action at this time.
0 commit comments