@@ -42,8 +42,6 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
42
42
*/
43
43
protected $ objectManager ;
44
44
45
-
46
-
47
45
protected function setUp ()
48
46
{
49
47
$ this ->objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
@@ -71,14 +69,14 @@ public function testConfigurableWithAttributesSortingImport()
71
69
'directory ' => $ directory
72
70
]
73
71
);
74
- $ errors = $ this ->model ->setSource (
75
- $ source
76
- )-> setParameters (
77
- [
78
- ' behavior ' => \ Magento \ ImportExport \ Model \Import:: BEHAVIOR_APPEND ,
79
- ' entity ' => ' catalog_product '
80
- ]
81
- ) ->validateData ();
72
+ $ errors = $ this ->model ->setSource ($ source )
73
+ -> setParameters (
74
+ [
75
+ ' behavior ' => \ Magento \ ImportExport \ Model \Import:: BEHAVIOR_APPEND ,
76
+ ' entity ' => ' catalog_product '
77
+ ]
78
+ )
79
+ ->validateData ();
82
80
83
81
$ this ->assertTrue ($ errors ->getErrorsCount () == 0 );
84
82
$ this ->model ->importData ();
@@ -113,65 +111,65 @@ public function testConfigurableWithAttributesSortingImport()
113
111
];
114
112
115
113
/** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $configurableProductOption */
116
- foreach ($ configurableProductOptions as $ configurableProductOption ){
117
- $ productAttribute = $ configurableProductOption ->getProductAttribute ();
118
- $ productAttributeCode = $ productAttribute ->getAttributeCode ();
119
- $ productAttributeData = $ productAttribute ->getData ();
120
- $ productAttributeDataExpectation = self ::getProductAttributesDataExpectation ()[$ productAttributeCode ];
121
-
122
- $ productOptionData = $ configurableProductOption ->getData ();
123
- $ productOptionLabel = $ productOptionData ['label ' ];
124
- $ productOptionsDataExpectation = self ::getProductOptionsDataExpectation ()[$ productOptionLabel ];
125
-
126
- if (isset ($ attributesPositionExpectation [$ productAttributeCode ])) {
127
- $ expectedPosition = $ attributesPositionExpectation [$ productAttributeCode ];
128
- $ this ->assertEquals ($ expectedPosition , $ configurableProductOption ->getPosition ());
129
- }
130
-
131
- $ this ->assertArrayHasKey ('product_super_attribute_id ' , $ productOptionData );
132
- $ this ->assertArrayHasKey ('product_id ' , $ productOptionData );
133
- $ this ->assertArrayHasKey ('attribute_id ' , $ productOptionData );
134
- $ this ->assertArrayHasKey ('position ' , $ productOptionData );
135
- $ this ->assertArrayHasKey ('extension_attributes ' , $ productOptionData );
136
- $ this ->assertArrayHasKey ('product_attribute ' , $ productOptionData );
137
- $ this ->assertArrayHasKey ('attribute_id ' , $ productAttributeData );
138
- $ this ->assertArrayHasKey ('entity_type_id ' , $ productAttributeData );
139
- $ this ->assertArrayHasKey ('attribute_code ' , $ productAttributeData );
140
- $ this ->assertArrayHasKey ('frontend_label ' , $ productAttributeData );
141
- $ this ->assertArrayHasKey ('label ' , $ productOptionData );
142
- $ this ->assertArrayHasKey ('use_default ' , $ productOptionData );
143
- $ this ->assertArrayHasKey ('options ' , $ productOptionData );
144
-
145
- $ this ->assertEquals (
146
- $ productAttributeDataExpectation ['attribute_code ' ],
147
- $ productAttributeData ['attribute_code ' ]
148
- );
149
- $ this ->assertEquals (
150
- $ product ->getData ('entity_id ' ),
151
- $ productOptionData ['product_id ' ]);
152
- $ this ->assertEquals (
153
- $ productAttributeDataExpectation ['frontend_label ' ],
154
- $ productAttributeData ['frontend_label ' ]
155
- );
156
- $ this ->assertEquals (
157
- $ productOptionsDataExpectation ['label ' ],
158
- $ productOptionData ['label ' ]
159
- );
160
- $ this ->assertEquals (
161
- $ productOptionsDataExpectation ['options ' ]['label ' ],
162
- $ productOptionData ['options ' ][0 ]['label ' ]
163
- );
164
- $ this ->assertEquals (
165
- $ productOptionsDataExpectation ['options ' ]['default_label ' ],
166
- $ productOptionData ['options ' ][0 ]['default_label ' ]
167
- );
168
- $ this ->assertEquals (
169
- $ productOptionsDataExpectation ['options ' ]['store_label ' ],
170
- $ productOptionData ['options ' ][0 ]['store_label ' ]
171
- );
172
- $ this ->assertArrayHasKey ('values ' , $ productOptionData );
173
- $ valuesData = $ productOptionData ['values ' ];
174
- $ this ->assertEquals (1 , count ($ valuesData ));
114
+ foreach ($ configurableProductOptions as $ configurableProductOption ) {
115
+ $ productAttribute = $ configurableProductOption ->getProductAttribute ();
116
+ $ productAttributeCode = $ productAttribute ->getAttributeCode ();
117
+ $ productAttributeData = $ productAttribute ->getData ();
118
+ $ productAttributeDataExpectation = self ::getProductAttributesDataExpectation ()[$ productAttributeCode ];
119
+
120
+ $ productOptionData = $ configurableProductOption ->getData ();
121
+ $ productOptionLabel = $ productOptionData ['label ' ];
122
+ $ productOptionsDataExpectation = self ::getProductOptionsDataExpectation ()[$ productOptionLabel ];
123
+
124
+ if (isset ($ attributesPositionExpectation [$ productAttributeCode ])) {
125
+ $ expectedPosition = $ attributesPositionExpectation [$ productAttributeCode ];
126
+ $ this ->assertEquals ($ expectedPosition , $ configurableProductOption ->getPosition ());
127
+ }
128
+
129
+ $ this ->assertArrayHasKey ('product_super_attribute_id ' , $ productOptionData );
130
+ $ this ->assertArrayHasKey ('product_id ' , $ productOptionData );
131
+ $ this ->assertArrayHasKey ('attribute_id ' , $ productOptionData );
132
+ $ this ->assertArrayHasKey ('position ' , $ productOptionData );
133
+ $ this ->assertArrayHasKey ('extension_attributes ' , $ productOptionData );
134
+ $ this ->assertArrayHasKey ('product_attribute ' , $ productOptionData );
135
+ $ this ->assertArrayHasKey ('attribute_id ' , $ productAttributeData );
136
+ $ this ->assertArrayHasKey ('entity_type_id ' , $ productAttributeData );
137
+ $ this ->assertArrayHasKey ('attribute_code ' , $ productAttributeData );
138
+ $ this ->assertArrayHasKey ('frontend_label ' , $ productAttributeData );
139
+ $ this ->assertArrayHasKey ('label ' , $ productOptionData );
140
+ $ this ->assertArrayHasKey ('use_default ' , $ productOptionData );
141
+ $ this ->assertArrayHasKey ('options ' , $ productOptionData );
142
+
143
+ $ this ->assertEquals (
144
+ $ productAttributeDataExpectation ['attribute_code ' ],
145
+ $ productAttributeData ['attribute_code ' ]
146
+ );
147
+ $ this ->assertEquals (
148
+ $ product ->getData ('entity_id ' ),
149
+ $ productOptionData ['product_id ' ]);
150
+ $ this ->assertEquals (
151
+ $ productAttributeDataExpectation ['frontend_label ' ],
152
+ $ productAttributeData ['frontend_label ' ]
153
+ );
154
+ $ this ->assertEquals (
155
+ $ productOptionsDataExpectation ['label ' ],
156
+ $ productOptionData ['label ' ]
157
+ );
158
+ $ this ->assertEquals (
159
+ $ productOptionsDataExpectation ['options ' ]['label ' ],
160
+ $ productOptionData ['options ' ][0 ]['label ' ]
161
+ );
162
+ $ this ->assertEquals (
163
+ $ productOptionsDataExpectation ['options ' ]['default_label ' ],
164
+ $ productOptionData ['options ' ][0 ]['default_label ' ]
165
+ );
166
+ $ this ->assertEquals (
167
+ $ productOptionsDataExpectation ['options ' ]['store_label ' ],
168
+ $ productOptionData ['options ' ][0 ]['store_label ' ]
169
+ );
170
+ $ this ->assertArrayHasKey ('values ' , $ productOptionData );
171
+ $ valuesData = $ productOptionData ['values ' ];
172
+ $ this ->assertEquals (1 , count ($ valuesData ));
175
173
}
176
174
}
177
175
@@ -189,8 +187,6 @@ private function getProductOptionsDataExpectation()
189
187
'store_label ' => 'Option 1 '
190
188
]
191
189
],
192
-
193
-
194
190
'Test attribute 2 ' => [
195
191
'label ' => 'Test attribute 2 ' ,
196
192
'options ' => [
0 commit comments