Skip to content

Commit b3f9921

Browse files
author
Bohdan Korablov
committed
MAGETWO-59743: Product deleted after import with Replace behavior
1 parent 9a0e336 commit b3f9921

File tree

1 file changed

+85
-0
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import

1 file changed

+85
-0
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,4 +1431,89 @@ public function testProductWithWrappedAdditionalAttributes()
14311431
$this->assertEquals(implode(',', [$multiselectOptions[1]->getValue(), $multiselectOptions[2]->getValue()]),
14321432
$product2->getData('multiselect_attribute'));
14331433
}
1434+
1435+
/**
1436+
* @param array $row
1437+
* @param string|null $behavior
1438+
* @param bool $expectedResult
1439+
* @magentoAppArea adminhtml
1440+
* @magentoAppIsolation enabled
1441+
* @dataProvider validateRowDataProvider
1442+
*/
1443+
public function testValidateRow(array $row, $behavior, $expectedResult)
1444+
{
1445+
$this->_model->setParameters(['behavior' => $behavior]);
1446+
$this->assertSame($expectedResult, $this->_model->validateRow($row, 1));
1447+
}
1448+
1449+
/**
1450+
* @return array
1451+
*/
1452+
public function validateRowDataProvider()
1453+
{
1454+
return [
1455+
[
1456+
'row' => ['sku' => '24-MB01'],
1457+
'behavior' => null,
1458+
'expectedResult' => true,
1459+
],
1460+
[
1461+
'row' => ['sku' => '24-MB01-absent'],
1462+
'behavior' => null,
1463+
'expectedResult' => false,
1464+
],
1465+
[
1466+
'row' => [
1467+
'sku' => '24-MB01-absent',
1468+
'name' => 'Test',
1469+
'product_type' => 'simple',
1470+
'_attribute_set' => 'Default',
1471+
'price' => 10.20,
1472+
],
1473+
'behavior' => null,
1474+
'expectedResult' => true,
1475+
],
1476+
[
1477+
'row' => ['sku' => '24-MB01'],
1478+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
1479+
'expectedResult' => true,
1480+
],
1481+
[
1482+
'row' => ['sku' => '24-MB01-absent'],
1483+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
1484+
'expectedResult' => false,
1485+
],
1486+
[
1487+
'row' => [
1488+
'sku' => '24-MB01-absent',
1489+
'name' => 'Test',
1490+
'product_type' => 'simple',
1491+
'_attribute_set' => 'Default',
1492+
'price' => 10.20,
1493+
],
1494+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
1495+
'expectedResult' => true,
1496+
],
1497+
[
1498+
'row' => ['sku' => '24-MB01'],
1499+
'behavior' => Import::BEHAVIOR_DELETE,
1500+
'expectedResult' => true,
1501+
],
1502+
[
1503+
'row' => ['sku' => '24-MB01-absent'],
1504+
'behavior' => Import::BEHAVIOR_DELETE,
1505+
'expectedResult' => false,
1506+
],
1507+
[
1508+
'row' => ['sku' => '24-MB01'],
1509+
'behavior' => Import::BEHAVIOR_REPLACE,
1510+
'expectedResult' => false,
1511+
],
1512+
[
1513+
'row' => ['sku' => '24-MB01-absent'],
1514+
'behavior' => Import::BEHAVIOR_REPLACE,
1515+
'expectedResult' => false,
1516+
],
1517+
];
1518+
}
14341519
}

0 commit comments

Comments
 (0)