@@ -43,6 +43,11 @@ protected function setUp()
43
43
}
44
44
45
45
/**
46
+ * Test adding default attribute to product before save.
47
+ *
48
+ * @param array $rowData
49
+ * @param bool $withDefaultValue
50
+ * @param array $expectedAttributes
46
51
* @dataProvider prepareAttributesWithDefaultValueForSaveDataProvider
47
52
*/
48
53
public function testPrepareAttributesWithDefaultValueForSave ($ rowData , $ withDefaultValue , $ expectedAttributes )
@@ -52,9 +57,15 @@ public function testPrepareAttributesWithDefaultValueForSave($rowData, $withDefa
52
57
$ this ->assertArrayHasKey ($ key , $ actualAttributes );
53
58
$ this ->assertEquals ($ value , $ actualAttributes [$ key ]);
54
59
}
60
+
61
+ if (!empty ($ rowData ['_store ' ])) {
62
+ $ this ->assertEquals ($ expectedAttributes , $ actualAttributes , '' , 0.0 , 10 , true );
63
+ }
55
64
}
56
65
57
66
/**
67
+ * Data provider for testPrepareAttributesWithDefaultValueForSave.
68
+ *
58
69
* @return array
59
70
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
60
71
*/
@@ -78,6 +89,17 @@ public function prepareAttributesWithDefaultValueForSaveDataProvider()
78
89
false ,
79
90
['price ' => 65 , 'visibility ' => 1 , 'tax_class_id ' => '' ],
80
91
],
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
+ ],
81
103
'Adding new product with attributes that do not have default values ' => [
82
104
[
83
105
'sku ' => 'simple_product_3 ' ,
0 commit comments