Skip to content

Commit 181e24f

Browse files
committed
ACP2E-3660: REST endpoint Product Import Json not validate the mandatory fields
1 parent 2a8c78f commit 181e24f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,7 @@ public function validateRow(array $rowData, $rowNum)
27082708
// if product doesn't exist, need to throw critical error else all errors should be not critical.
27092709
$errorLevel = $this->getValidationErrorLevel($sku);
27102710

2711-
$hasValidatedImportParent = $sku && $this->skuProcessor->getNewSku($sku);
2711+
$hasValidatedImportParent = $sku && $this->getNewSku($sku);
27122712
$contextRowData = array_merge(['has_import_parent' => $hasValidatedImportParent], $rowData);
27132713
if (!$this->validator->isValid($contextRowData)) {
27142714
foreach ($this->validator->getMessages() as $message) {

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ public function testValidateRowValidateExistingProductTypeAddErrorRowCall(): voi
12421242
],
12431243
];
12441244
$importProduct = $this->createModelMockWithErrorAggregator(
1245-
['addRowError', 'getOptionEntity'],
1245+
['addRowError', 'getOptionEntity', 'getNewSku'],
12461246
['isRowInvalid' => true]
12471247
);
12481248

@@ -1300,7 +1300,7 @@ public function testValidateRowValidateNewProductTypeAddRowErrorCall(
13001300
$sku => null
13011301
];
13021302
$importProduct = $this->createModelMockWithErrorAggregator(
1303-
['addRowError', 'getOptionEntity'],
1303+
['addRowError', 'getOptionEntity', 'getNewSku'],
13041304
['isRowInvalid' => true]
13051305
);
13061306

@@ -1356,7 +1356,7 @@ public function testValidateRowValidateNewProductTypeGetNewSkuCall(): void
13561356
$this->setPropertyValue($importProduct, '_productTypeModels', $_productTypeModels);
13571357
$this->setPropertyValue($importProduct, '_attrSetNameToId', $_attrSetNameToId);
13581358

1359-
$this->skuProcessor->expects($this->once())->method('getNewSku')->willReturn(null);
1359+
$this->skuProcessor->expects($this->exactly(2))->method('getNewSku')->willReturn(null);
13601360
$this->skuProcessor->expects($this->once())->method('addNewSku')->with($sku, $expectedData);
13611361
$this->setPropertyValue($importProduct, 'skuProcessor', $this->skuProcessor);
13621362
$this->setPrivatePropertyValue($importProduct, 'skuStorage', $this->skuStorageMock);

0 commit comments

Comments
 (0)