Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
GraphQL-429: Test coverage: nonExistentCart
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav committed Mar 12, 2019
1 parent 4550597 commit 350d1f8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,30 +411,16 @@ public function testSetBillingAddressIfCustomerIsNotOwnerOfAddress()
public function testSetBillingAddressOnNonExistentCart()
{
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getCartQuery($maskedQuoteId);
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}

/**
* @param string $maskedQuoteId
* @return string
*/
private function getCartQuery(
string $maskedQuoteId
) : string {
return <<<QUERY
$query = <<<QUERY
{
cart(cart_id: "$maskedQuoteId") {
items {
id
qty
product {
sku
}
}
}
}
QUERY;
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,30 +159,16 @@ public function testSetPaymentMethodToAnotherCustomerCart()
public function testPaymentMethodOnNonExistentCart()
{
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getCartQuery($maskedQuoteId);
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}

/**
* @param string $maskedQuoteId
* @return string
*/
private function getCartQuery(
string $maskedQuoteId
) : string {
return <<<QUERY
$query = <<<QUERY
{
cart(cart_id: "$maskedQuoteId") {
items {
id
qty
product {
sku
}
}
}
}
QUERY;
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,30 +251,16 @@ public function testSetBillingAddressFromAddressBook()
public function testSetBillingAddressOnNonExistentCart()
{
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getCartQuery($maskedQuoteId);
$this->graphQlQuery($query);
}

/**
* @param string $maskedQuoteId
* @return string
*/
private function getCartQuery(
string $maskedQuoteId
) : string {
return <<<QUERY
$query = <<<QUERY
{
cart(cart_id: "$maskedQuoteId") {
items {
id
qty
product {
sku
}
}
}
}
QUERY;
$this->graphQlQuery($query);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ public function testSetPaymentMethodToCustomerCart()
public function testSetPaymentOnNonExistentCart()
{
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getCartQuery($maskedQuoteId);
$query = <<<QUERY
{
cart(cart_id: "$maskedQuoteId") {
items {
id
}
}
}
QUERY;
$this->graphQlQuery($query);
}

Expand Down Expand Up @@ -166,28 +174,6 @@ private function prepareMutationQuery(
QUERY;
}

/**
* @param string $maskedQuoteId
* @return string
*/
private function getCartQuery(
string $maskedQuoteId
) : string {
return <<<QUERY
{
cart(cart_id: "$maskedQuoteId") {
items {
id
qty
product {
sku
}
}
}
}
QUERY;
}

/**
* @param string $reversedQuoteId
* @param int $customerId
Expand Down

0 comments on commit 350d1f8

Please sign in to comment.