Skip to content

Commit 504aeb6

Browse files
committed
MAGETWO-73922: Import doesn't allow to set default value per store view (dropdown fields)
1 parent 6ab0dee commit 504aeb6

File tree

1 file changed

+22
-0
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/Product/Type

1 file changed

+22
-0
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ protected function setUp()
4343
}
4444

4545
/**
46+
* Test adding default attribute to product before save.
47+
*
48+
* @param array $rowData
49+
* @param bool $withDefaultValue
50+
* @param array $expectedAttributes
4651
* @dataProvider prepareAttributesWithDefaultValueForSaveDataProvider
4752
*/
4853
public function testPrepareAttributesWithDefaultValueForSave($rowData, $withDefaultValue, $expectedAttributes)
@@ -52,9 +57,15 @@ public function testPrepareAttributesWithDefaultValueForSave($rowData, $withDefa
5257
$this->assertArrayHasKey($key, $actualAttributes);
5358
$this->assertEquals($value, $actualAttributes[$key]);
5459
}
60+
61+
if (!empty($rowData['_store'])) {
62+
$this->assertEquals($expectedAttributes, $actualAttributes, '', 0.0, 10, true);
63+
}
5564
}
5665

5766
/**
67+
* Data provider for testPrepareAttributesWithDefaultValueForSave.
68+
*
5869
* @return array
5970
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
6071
*/
@@ -78,6 +89,17 @@ public function prepareAttributesWithDefaultValueForSaveDataProvider()
7889
false,
7990
['price' => 65, 'visibility' => 1, 'tax_class_id' => ''],
8091
],
92+
'Updating existing product with attributes that do not have default values with store in dataRow' => [
93+
[
94+
'sku' => 'simple_product_3',
95+
'price' => 75,
96+
'_attribute_set' => 'Default',
97+
'product_type' => 'simple',
98+
'_store' => 1
99+
],
100+
true,
101+
['price' => 75],
102+
],
81103
'Adding new product with attributes that do not have default values' => [
82104
[
83105
'sku' => 'simple_product_3',

0 commit comments

Comments
 (0)