Skip to content

Commit 9574e6e

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

File tree

1 file changed

+35
-11
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import

1 file changed

+35
-11
lines changed

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

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,11 +1438,13 @@ public function testProductWithWrappedAdditionalAttributes()
14381438
* @param bool $expectedResult
14391439
* @magentoAppArea adminhtml
14401440
* @magentoAppIsolation enabled
1441+
* @magentoDbIsolation enabled
1442+
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
14411443
* @dataProvider validateRowDataProvider
14421444
*/
14431445
public function testValidateRow(array $row, $behavior, $expectedResult)
14441446
{
1445-
$this->_model->setParameters(['behavior' => $behavior]);
1447+
$this->_model->setParameters(['behavior' => $behavior, 'entity' => 'catalog_product']);
14461448
$this->assertSame($expectedResult, $this->_model->validateRow($row, 1));
14471449
}
14481450

@@ -1453,18 +1455,18 @@ public function validateRowDataProvider()
14531455
{
14541456
return [
14551457
[
1456-
'row' => ['sku' => '24-MB01'],
1458+
'row' => ['sku' => 'simple products'],
14571459
'behavior' => null,
14581460
'expectedResult' => true,
14591461
],
14601462
[
1461-
'row' => ['sku' => '24-MB01-absent'],
1463+
'row' => ['sku' => 'simple products absent'],
14621464
'behavior' => null,
14631465
'expectedResult' => false,
14641466
],
14651467
[
14661468
'row' => [
1467-
'sku' => '24-MB01-absent',
1469+
'sku' => 'simple products absent',
14681470
'name' => 'Test',
14691471
'product_type' => 'simple',
14701472
'_attribute_set' => 'Default',
@@ -1474,18 +1476,18 @@ public function validateRowDataProvider()
14741476
'expectedResult' => true,
14751477
],
14761478
[
1477-
'row' => ['sku' => '24-MB01'],
1479+
'row' => ['sku' => 'simple products'],
14781480
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
14791481
'expectedResult' => true,
14801482
],
14811483
[
1482-
'row' => ['sku' => '24-MB01-absent'],
1484+
'row' => ['sku' => 'simple products absent'],
14831485
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
14841486
'expectedResult' => false,
14851487
],
14861488
[
14871489
'row' => [
1488-
'sku' => '24-MB01-absent',
1490+
'sku' => 'simple products absent',
14891491
'name' => 'Test',
14901492
'product_type' => 'simple',
14911493
'_attribute_set' => 'Default',
@@ -1495,25 +1497,47 @@ public function validateRowDataProvider()
14951497
'expectedResult' => true,
14961498
],
14971499
[
1498-
'row' => ['sku' => '24-MB01'],
1500+
'row' => ['sku' => 'simple products'],
14991501
'behavior' => Import::BEHAVIOR_DELETE,
15001502
'expectedResult' => true,
15011503
],
15021504
[
1503-
'row' => ['sku' => '24-MB01-absent'],
1505+
'row' => ['sku' => 'simple products absent'],
15041506
'behavior' => Import::BEHAVIOR_DELETE,
15051507
'expectedResult' => false,
15061508
],
15071509
[
1508-
'row' => ['sku' => '24-MB01'],
1510+
'row' => ['sku' => 'simple products'],
1511+
'behavior' => Import::BEHAVIOR_REPLACE,
1512+
'expectedResult' => false,
1513+
],
1514+
[
1515+
'row' => ['sku' => 'simple products absent'],
15091516
'behavior' => Import::BEHAVIOR_REPLACE,
15101517
'expectedResult' => false,
15111518
],
15121519
[
1513-
'row' => ['sku' => '24-MB01-absent'],
1520+
'row' => [
1521+
'sku' => 'simple products absent',
1522+
'name' => 'Test',
1523+
'product_type' => 'simple',
1524+
'_attribute_set' => 'Default',
1525+
'price' => 10.20,
1526+
],
15141527
'behavior' => Import::BEHAVIOR_REPLACE,
15151528
'expectedResult' => false,
15161529
],
1530+
[
1531+
'row' => [
1532+
'sku' => 'simple products',
1533+
'name' => 'Test',
1534+
'product_type' => 'simple',
1535+
'_attribute_set' => 'Default',
1536+
'price' => 10.20,
1537+
],
1538+
'behavior' => Import::BEHAVIOR_REPLACE,
1539+
'expectedResult' => true,
1540+
],
15171541
];
15181542
}
15191543
}

0 commit comments

Comments
 (0)