Skip to content

Commit 07c0fbe

Browse files
committed
Test coverage: Add product to Cart with wrong cart hash
1 parent e51df41 commit 07c0fbe

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,45 @@ public function testAddProductIfQuantityIsNotAvailable()
8181
}
8282
}
8383
}
84+
QUERY;
85+
86+
$this->graphQlQuery($query);
87+
}
88+
89+
/**
90+
* @magentoApiDataFixture Magento/Catalog/_files/products.php
91+
* @expectedException \Exception
92+
* @expectedExceptionMessage Could not find a cart with ID "wrong_cart_hash"
93+
*/
94+
public function testAddProductWithWrongCartHash()
95+
{
96+
$sku = 'simple';
97+
$qty = 1;
98+
99+
$maskedQuoteId = 'wrong_cart_hash';
100+
101+
$query = <<<QUERY
102+
mutation {
103+
addSimpleProductsToCart(
104+
input: {
105+
cart_id: "{$maskedQuoteId}"
106+
cartItems: [
107+
{
108+
data: {
109+
qty: $qty
110+
sku: "$sku"
111+
}
112+
}
113+
]
114+
}
115+
) {
116+
cart {
117+
items {
118+
qty
119+
}
120+
}
121+
}
122+
}
84123
QUERY;
85124

86125
$this->graphQlQuery($query);

0 commit comments

Comments
 (0)