Skip to content

Commit 158f788

Browse files
committed
MC-26683: Added test case for 'Some of the products are out of stock.' case
1 parent 2d87219 commit 158f788

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\GraphQl\Quote\Guest;
99

1010
use Exception;
11+
use Magento\Framework\Exception\NoSuchEntityException;
1112
use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
1213
use Magento\TestFramework\Helper\Bootstrap;
1314
use Magento\TestFramework\TestCase\GraphQl\ResponseContainsErrorsException;
@@ -107,22 +108,26 @@ public function testAddDisabledProductToCart(): void
107108
/**
108109
* Add out of stock product to cart
109110
*
110-
* @magentoApiDataFixture Magento/Catalog/_files/product_virtual_out_of_stock.php
111+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
112+
* @magentoApiDataFixture Magento/Catalog/_files/multiple_products.php
111113
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
114+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
115+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
116+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/set_simple_product_out_of_stock.php
112117
* @return void
118+
* @throws NoSuchEntityException
113119
*/
114120
public function testAddOutOfStockProductToCart(): void
115121
{
116-
$sku = 'virtual-product-out';
117-
$quantity = 2;
122+
$sku = 'simple1';
123+
$quantity = 1;
118124

119125
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
120126
$query = $this->getQuery($maskedQuoteId, $sku, $quantity);
121127

122128
$this->expectException(ResponseContainsErrorsException::class);
123129
$this->expectExceptionMessage(
124-
'Could not add the product with SKU ' . $sku . ' to the shopping cart: ' .
125-
'Product that you are trying to add is not available.'
130+
'Some of the products are out of stock.'
126131
);
127132

128133
$this->graphQlMutation($query);

0 commit comments

Comments
 (0)