Skip to content

Commit e5bcdb6

Browse files
authored
ENGCOM-4488: Test coverage: Add product to Cart with wrong cart hash #462
2 parents f6c237e + 04328a6 commit e5bcdb6

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
@@ -105,4 +105,43 @@ public function getAddSimpleProductQuery(string $maskedQuoteId, string $sku, int
105105
}
106106
QUERY;
107107
}
108+
109+
/**
110+
* @magentoApiDataFixture Magento/Catalog/_files/products.php
111+
* @expectedException \Exception
112+
* @expectedExceptionMessage Could not find a cart with ID "wrong_cart_hash"
113+
*/
114+
public function testAddProductWithWrongCartHash()
115+
{
116+
$sku = 'simple';
117+
$qty = 1;
118+
119+
$maskedQuoteId = 'wrong_cart_hash';
120+
121+
$query = <<<QUERY
122+
mutation {
123+
addSimpleProductsToCart(
124+
input: {
125+
cart_id: "{$maskedQuoteId}"
126+
cartItems: [
127+
{
128+
data: {
129+
qty: $qty
130+
sku: "$sku"
131+
}
132+
}
133+
]
134+
}
135+
) {
136+
cart {
137+
items {
138+
qty
139+
}
140+
}
141+
}
142+
}
143+
QUERY;
144+
145+
$this->graphQlQuery($query);
146+
}
108147
}

0 commit comments

Comments
 (0)