@@ -199,7 +199,7 @@ public function testAddVariationFromAnotherConfigurableProductWithDifferentSuper
199
199
/**
200
200
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
201
201
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
202
- * @expectedException \ Exception
202
+ * @expectedException Exception
203
203
* @expectedExceptionMessage The requested qty is not available
204
204
*/
205
205
public function testAddProductIfQuantityIsNotAvailable ()
@@ -224,7 +224,7 @@ public function testAddProductIfQuantityIsNotAvailable()
224
224
/**
225
225
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
226
226
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
227
- * @expectedException \ Exception
227
+ * @expectedException Exception
228
228
* @expectedExceptionMessage Could not find a product with SKU "configurable_no_exist"
229
229
*/
230
230
public function testAddNonExistentConfigurableProductParentToCart ()
@@ -263,7 +263,7 @@ public function testAddNonExistentConfigurableProductVariationToCart()
263
263
2000
264
264
);
265
265
266
- $ this ->expectException (\ Exception::class);
266
+ $ this ->expectException (Exception::class);
267
267
$ this ->expectExceptionMessage (
268
268
'Could not add the product with SKU configurable to the shopping cart: The product that was requested ' .
269
269
'doesn \'t exist. Verify the product and try again. '
@@ -272,6 +272,58 @@ public function testAddNonExistentConfigurableProductVariationToCart()
272
272
$ this ->graphQlMutation ($ query );
273
273
}
274
274
275
+ /**
276
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php
277
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
278
+ */
279
+ public function testAddDisabledVariationToCart ()
280
+ {
281
+ $ searchResponse = $ this ->graphQlQuery ($ this ->getFetchProductQuery ('configurable ' ));
282
+ $ product = current ($ searchResponse ['products ' ]['items ' ]);
283
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
284
+ $ parentSku = $ product ['sku ' ];
285
+ $ sku = 'simple_10 ' ;
286
+ $ query = $ this ->getQuery (
287
+ $ maskedQuoteId ,
288
+ $ parentSku ,
289
+ $ sku ,
290
+ 1
291
+ );
292
+
293
+ $ this ->expectException (Exception::class);
294
+ $ this ->expectExceptionMessage (
295
+ 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock. '
296
+ );
297
+
298
+ $ this ->graphQlMutation ($ query );
299
+ }
300
+
301
+ /**
302
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php
303
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
304
+ */
305
+ public function testOutOfStockVariationToCart ()
306
+ {
307
+ $ searchResponse = $ this ->graphQlQuery ($ this ->getFetchProductQuery ('configurable ' ));
308
+ $ product = current ($ searchResponse ['products ' ]['items ' ]);
309
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
310
+ $ parentSku = $ product ['sku ' ];
311
+ $ sku = 'simple_10 ' ;
312
+ $ query = $ this ->getQuery (
313
+ $ maskedQuoteId ,
314
+ $ parentSku ,
315
+ $ sku ,
316
+ 1
317
+ );
318
+
319
+ $ this ->expectException (Exception::class);
320
+ $ this ->expectExceptionMessage (
321
+ 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock. '
322
+ );
323
+
324
+ $ this ->graphQlMutation ($ query );
325
+ }
326
+
275
327
/**
276
328
* @param string $maskedQuoteId
277
329
* @param string $parentSku
0 commit comments