Skip to content

Commit 95e2303

Browse files
ENGCOM-4487: 429 - Test coverage: nonExistentCart #444
- Merge Pull Request magento/graphql-ce#444 from magento/graphql-ce:429-test-coverage-nonExistentCart - Merged commits: 1. 990a373 2. 4550597 3. 350d1f8
2 parents 9d231d1 + 350d1f8 commit 95e2303

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,26 @@ public function testSetBillingAddressIfCustomerIsNotOwnerOfAddress()
403403
$this->graphQlQuery($query, [], '', $this->getHeaderMap('[email protected]'));
404404
}
405405

406+
/**
407+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
408+
* @expectedException \Exception
409+
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
410+
*/
411+
public function testSetBillingAddressOnNonExistentCart()
412+
{
413+
$maskedQuoteId = 'non_existent_masked_id';
414+
$query = <<<QUERY
415+
{
416+
cart(cart_id: "$maskedQuoteId") {
417+
items {
418+
id
419+
}
420+
}
421+
}
422+
QUERY;
423+
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
424+
}
425+
406426
/**
407427
* Verify the all the whitelisted fields for a New Address Object
408428
*

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ public function testSetPaymentMethodToAnotherCustomerCart()
151151
$this->graphQlQuery($query, [], '', $this->getHeaderMap('[email protected]'));
152152
}
153153

154+
/**
155+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
156+
* @expectedException \Exception
157+
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
158+
*/
159+
public function testPaymentMethodOnNonExistentCart()
160+
{
161+
$maskedQuoteId = 'non_existent_masked_id';
162+
$query = <<<QUERY
163+
{
164+
cart(cart_id: "$maskedQuoteId") {
165+
items {
166+
id
167+
}
168+
}
169+
}
170+
QUERY;
171+
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
172+
}
173+
154174
/**
155175
* @param string $maskedQuoteId
156176
* @param string $methodCode

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,25 @@ public function testSetBillingAddressFromAddressBook()
244244
$this->graphQlQuery($query);
245245
}
246246

247+
/**
248+
* @expectedException \Exception
249+
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
250+
*/
251+
public function testSetBillingAddressOnNonExistentCart()
252+
{
253+
$maskedQuoteId = 'non_existent_masked_id';
254+
$query = <<<QUERY
255+
{
256+
cart(cart_id: "$maskedQuoteId") {
257+
items {
258+
id
259+
}
260+
}
261+
}
262+
QUERY;
263+
$this->graphQlQuery($query);
264+
}
265+
247266
/**
248267
* Verify the all the whitelisted fields for a New Address Object
249268
*

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ public function testSetPaymentMethodToCustomerCart()
126126
$this->graphQlQuery($query);
127127
}
128128

129+
/**
130+
* @expectedException \Exception
131+
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
132+
*/
133+
public function testSetPaymentOnNonExistentCart()
134+
{
135+
$maskedQuoteId = 'non_existent_masked_id';
136+
$query = <<<QUERY
137+
{
138+
cart(cart_id: "$maskedQuoteId") {
139+
items {
140+
id
141+
}
142+
}
143+
}
144+
QUERY;
145+
$this->graphQlQuery($query);
146+
}
147+
129148
/**
130149
* @param string $maskedQuoteId
131150
* @param string $methodCode

0 commit comments

Comments
 (0)