Skip to content

Commit e18e4ac

Browse files
committed
Fix message when maxSaleQty is set and qty is more than maxSaleQty
1 parent 3fbdc45 commit e18e4ac

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

+9-12
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,15 @@ public function testAddSimpleProductsToCart()
6767

6868
/**
6969
* @magentoApiDataFixture Magento/Catalog/_files/products.php
70-
7170
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
7271
* @expectedException \Exception
73-
* @expectedExceptionMessage The most you may purchase is 5.
72+
* @expectedExceptionMessage The requested qty is not available
7473
*/
75-
public function testAddMoreProductsThatAllowed()
74+
public function testAddProductIfQuantityIsNotAvailable()
7675
{
7776
$sku = 'simple';
78-
$qty = 7;
79-
$maxQty = 5;
77+
$qty = 200;
8078

81-
$this->config->saveConfig('cataloginventory/item_options/max_sale_qty', $maxQty, 'default', 0);
8279
$maskedQuoteId = $this->getMaskedQuoteId();
8380
$query = $this->getQueryAddSimpleProduct($maskedQuoteId, $sku, $qty);
8481
$this->graphQlQuery($query);
@@ -87,22 +84,22 @@ public function testAddMoreProductsThatAllowed()
8784
/**
8885
* @magentoApiDataFixture Magento/Catalog/_files/products.php
8986
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
90-
* @expectedException \Exception
91-
* @expectedExceptionMessage The requested qty is not available
87+
* @expectedExceptionMessage The most you may purchase is 5.
9288
*/
93-
public function testAddProductIfQuantityIsNotAvailable()
89+
public function testAddMoreProductsThatAllowed()
9490
{
95-
$sku = 'simple';
96-
$qty = 200;
91+
$sku = 'custom-design-simple-product';
92+
$qty = 7;
93+
$maxQty = 5;
9794

95+
$this->config->saveConfig('cataloginventory/item_options/max_sale_qty', $maxQty, 'default', 0);
9896
$maskedQuoteId = $this->getMaskedQuoteId();
9997
$query = $this->getQueryAddSimpleProduct($maskedQuoteId, $sku, $qty);
10098
$this->graphQlQuery($query);
10199
}
102100

103101
/**
104102
* @return string
105-
* @throws \Magento\Framework\Exception\NoSuchEntityException
106103
*/
107104
public function getMaskedQuoteId() : string
108105
{

0 commit comments

Comments
 (0)