@@ -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,60 @@ public function testAddNonExistentConfigurableProductVariationToCart()
272
272
$ this ->graphQlMutation ($ query );
273
273
}
274
274
275
+ /**
276
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
277
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_disable_first_child.php
278
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
279
+ */
280
+ public function testAddDisabledVariationToCart ()
281
+ {
282
+ $ searchResponse = $ this ->graphQlQuery ($ this ->getFetchProductQuery ('configurable ' ));
283
+ $ product = current ($ searchResponse ['products ' ]['items ' ]);
284
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
285
+ $ parentSku = $ product ['sku ' ];
286
+ $ sku = 'simple_10 ' ;
287
+ $ query = $ this ->getQuery (
288
+ $ maskedQuoteId ,
289
+ $ parentSku ,
290
+ $ sku ,
291
+ 1
292
+ );
293
+
294
+ $ this ->expectException (Exception::class);
295
+ $ this ->expectExceptionMessage (
296
+ 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock. '
297
+ );
298
+
299
+ $ this ->graphQlMutation ($ query );
300
+ }
301
+
302
+ /**
303
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
304
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_zero_qty_first_child.php
305
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
306
+ */
307
+ public function testOutOfStockVariationToCart ()
308
+ {
309
+ $ searchResponse = $ this ->graphQlQuery ($ this ->getFetchProductQuery ('configurable ' ));
310
+ $ product = current ($ searchResponse ['products ' ]['items ' ]);
311
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_order_1 ' );
312
+ $ parentSku = $ product ['sku ' ];
313
+ $ sku = 'simple_10 ' ;
314
+ $ query = $ this ->getQuery (
315
+ $ maskedQuoteId ,
316
+ $ parentSku ,
317
+ $ sku ,
318
+ 1
319
+ );
320
+
321
+ $ this ->expectException (Exception::class);
322
+ $ this ->expectExceptionMessage (
323
+ 'Could not add the product with SKU configurable to the shopping cart: This product is out of stock. '
324
+ );
325
+
326
+ $ this ->graphQlMutation ($ query );
327
+ }
328
+
275
329
/**
276
330
* @param string $maskedQuoteId
277
331
* @param string $parentSku
0 commit comments