Skip to content

Commit 350d1f8

Browse files
committed
GraphQL-429: Test coverage: nonExistentCart
1 parent 4550597 commit 350d1f8

File tree

4 files changed

+15
-71
lines changed

4 files changed

+15
-71
lines changed

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -411,30 +411,16 @@ public function testSetBillingAddressIfCustomerIsNotOwnerOfAddress()
411411
public function testSetBillingAddressOnNonExistentCart()
412412
{
413413
$maskedQuoteId = 'non_existent_masked_id';
414-
$query = $this->getCartQuery($maskedQuoteId);
415-
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
416-
}
417-
418-
/**
419-
* @param string $maskedQuoteId
420-
* @return string
421-
*/
422-
private function getCartQuery(
423-
string $maskedQuoteId
424-
) : string {
425-
return <<<QUERY
414+
$query = <<<QUERY
426415
{
427416
cart(cart_id: "$maskedQuoteId") {
428417
items {
429418
id
430-
qty
431-
product {
432-
sku
433-
}
434419
}
435420
}
436421
}
437422
QUERY;
423+
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
438424
}
439425

440426
/**

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,30 +159,16 @@ public function testSetPaymentMethodToAnotherCustomerCart()
159159
public function testPaymentMethodOnNonExistentCart()
160160
{
161161
$maskedQuoteId = 'non_existent_masked_id';
162-
$query = $this->getCartQuery($maskedQuoteId);
163-
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
164-
}
165-
166-
/**
167-
* @param string $maskedQuoteId
168-
* @return string
169-
*/
170-
private function getCartQuery(
171-
string $maskedQuoteId
172-
) : string {
173-
return <<<QUERY
162+
$query = <<<QUERY
174163
{
175164
cart(cart_id: "$maskedQuoteId") {
176165
items {
177166
id
178-
qty
179-
product {
180-
sku
181-
}
182167
}
183168
}
184169
}
185170
QUERY;
171+
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
186172
}
187173

188174
/**

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,30 +251,16 @@ public function testSetBillingAddressFromAddressBook()
251251
public function testSetBillingAddressOnNonExistentCart()
252252
{
253253
$maskedQuoteId = 'non_existent_masked_id';
254-
$query = $this->getCartQuery($maskedQuoteId);
255-
$this->graphQlQuery($query);
256-
}
257-
258-
/**
259-
* @param string $maskedQuoteId
260-
* @return string
261-
*/
262-
private function getCartQuery(
263-
string $maskedQuoteId
264-
) : string {
265-
return <<<QUERY
254+
$query = <<<QUERY
266255
{
267256
cart(cart_id: "$maskedQuoteId") {
268257
items {
269258
id
270-
qty
271-
product {
272-
sku
273-
}
274259
}
275260
}
276261
}
277262
QUERY;
263+
$this->graphQlQuery($query);
278264
}
279265

280266
/**

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

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ public function testSetPaymentMethodToCustomerCart()
133133
public function testSetPaymentOnNonExistentCart()
134134
{
135135
$maskedQuoteId = 'non_existent_masked_id';
136-
$query = $this->getCartQuery($maskedQuoteId);
136+
$query = <<<QUERY
137+
{
138+
cart(cart_id: "$maskedQuoteId") {
139+
items {
140+
id
141+
}
142+
}
143+
}
144+
QUERY;
137145
$this->graphQlQuery($query);
138146
}
139147

@@ -166,28 +174,6 @@ private function prepareMutationQuery(
166174
QUERY;
167175
}
168176

169-
/**
170-
* @param string $maskedQuoteId
171-
* @return string
172-
*/
173-
private function getCartQuery(
174-
string $maskedQuoteId
175-
) : string {
176-
return <<<QUERY
177-
{
178-
cart(cart_id: "$maskedQuoteId") {
179-
items {
180-
id
181-
qty
182-
product {
183-
sku
184-
}
185-
}
186-
}
187-
}
188-
QUERY;
189-
}
190-
191177
/**
192178
* @param string $reversedQuoteId
193179
* @param int $customerId

0 commit comments

Comments
 (0)