Skip to content

Commit 25e1590

Browse files
author
Vitaliy Boyko
committed
graphQl-810: test add non existent configurable product
1 parent 7cf99d1 commit 25e1590

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,53 @@ public function testAddProductIfQuantityIsNotAvailable()
9292
$this->graphQlMutation($query);
9393
}
9494

95+
/**
96+
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
97+
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
98+
* @expectedException \Exception
99+
* @expectedExceptionMessage Could not find a product with SKU "configurable_no_exist"
100+
*/
101+
public function testAddNonExistentConfigurableProductParentToCart()
102+
{
103+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
104+
$parentSku = 'configurable_no_exist';
105+
$sku = 'simple_20';
106+
107+
$query = $this->getQuery(
108+
$maskedQuoteId,
109+
$parentSku,
110+
$sku,
111+
2000
112+
);
113+
114+
$this->graphQlMutation($query);
115+
}
116+
117+
/**
118+
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_sku.php
119+
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
120+
* @expectedException \Exception
121+
* @expectedExceptionMessage Could not add the product with SKU configurable to the shopping cart: Could not find specified product.
122+
*/
123+
public function testAddNonExistentConfigurableProductVariationToCart()
124+
{
125+
$searchResponse = $this->graphQlQuery($this->getFetchProductQuery('configurable'));
126+
$product = current($searchResponse['products']['items']);
127+
128+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
129+
$parentSku = $product['sku'];
130+
$sku = 'simple_no_exist';
131+
132+
$query = $this->getQuery(
133+
$maskedQuoteId,
134+
$parentSku,
135+
$sku,
136+
2000
137+
);
138+
139+
$this->graphQlMutation($query);
140+
}
141+
95142
/**
96143
* @param string $maskedQuoteId
97144
* @param string $parentSku

0 commit comments

Comments
 (0)