@@ -141,26 +141,26 @@ public function testAddMultipleConfigurableProductToCart()
141
141
}
142
142
143
143
/**
144
- * TODO: Verify whether exception should be thrown in this scenario
145
- *
146
144
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_products.php
147
145
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
146
+ *
147
+ * @expectedException Exception
148
+ * @expectedExceptionMessage You need to choose options for your item.
148
149
*/
149
150
public function testAddVariationFromAnotherConfigurableProductWithTheSameSuperAttributeToCart ()
150
151
{
152
+ $ this ->markTestSkipped (
153
+ 'Magento automatically selects the correct child product according to the super attribute
154
+ https://github.com/magento/graphql-ce/issues/940 '
155
+ );
156
+
151
157
$ searchResponse = $ this ->graphQlQuery ($ this ->getFetchProductQuery ('configurable_12345 ' ));
152
158
$ product = current ($ searchResponse ['products ' ]['items ' ]);
153
- $ attributeId = (int ) $ product ['configurable_options ' ][0 ]['attribute_id ' ];
154
- $ optionId = $ product ['configurable_options ' ][0 ]['values ' ][1 ]['value_index ' ];
155
159
156
160
$ quantity = 2 ;
157
161
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
158
162
$ parentSku = $ product ['sku ' ];
159
163
160
- //'configurable' -> ['simple_10', 'simple_20']
161
- //'configurable_12345' -> ['simple_30', 'simple_40']
162
- //'simple_20' has same configurable option value index (super attribute) as 'simple_40'
163
- //therefore 'simple_40' should be added to cart
164
164
$ sku = 'simple_20 ' ;
165
165
166
166
$ query = $ this ->getQuery (
@@ -170,18 +170,7 @@ public function testAddVariationFromAnotherConfigurableProductWithTheSameSuperAt
170
170
$ quantity
171
171
);
172
172
173
- $ response = $ this ->graphQlMutation ($ query );
174
-
175
- $ cartItem = current ($ response ['addConfigurableProductsToCart ' ]['cart ' ]['items ' ]);
176
- self ::assertEquals ($ quantity , $ cartItem ['quantity ' ]);
177
- self ::assertEquals ($ parentSku , $ cartItem ['product ' ]['sku ' ]);
178
- self ::assertArrayHasKey ('configurable_options ' , $ cartItem );
179
-
180
- $ option = current ($ cartItem ['configurable_options ' ]);
181
- self ::assertEquals ($ attributeId , $ option ['id ' ]);
182
- self ::assertEquals ($ optionId , $ option ['value_id ' ]);
183
- self ::assertArrayHasKey ('option_label ' , $ option );
184
- self ::assertArrayHasKey ('value_label ' , $ option );
173
+ $ this ->graphQlMutation ($ query );
185
174
}
186
175
187
176
/**
@@ -200,10 +189,6 @@ public function testAddVariationFromAnotherConfigurableProductWithDifferentSuper
200
189
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
201
190
$ parentSku = $ product ['sku ' ];
202
191
203
- //'configurable' -> ['simple_10', 'simple_20']
204
- //'configurable_12345' -> ['simple_30', 'simple_40']
205
- //'simple_20' hasn't any common configurable option with 'configurable_12345' children
206
- //therefore exception is thrown
207
192
$ sku = 'simple_20 ' ;
208
193
209
194
$ query = $ this ->getQuery (
0 commit comments