Skip to content

Commit

Permalink
ENGCOM-4495: graphQl-430: added testReSetPaymentMethod for guest and …
Browse files Browse the repository at this point in the history
…customer #471

 - Merge Pull Request magento/graphql-ce#471 from magento/graphql-ce:GrqphQL-430-test-testReSetPaymentMethod
 - Merged commits:
   1. 80499c9
  • Loading branch information
magento-engcom-team committed Mar 13, 2019
2 parents 6cc68c6 + 80499c9 commit 8cde976
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ public function testPaymentMethodOnNonExistentCart()
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_payment_saved.php
*/
public function testReSetPayment()
{
/** @var \Magento\Quote\Model\Quote $quote */
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId('test_order_1_with_payment');
$methodCode = Checkmo::PAYMENT_METHOD_CHECKMO_CODE;
$query = $this->prepareMutationQuery($maskedQuoteId, $methodCode);
$response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());

self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']);
self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']);
}

/**
* @param string $maskedQuoteId
* @param string $methodCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@ public function testSetPaymentOnNonExistentCart()
$this->graphQlQuery($query);
}

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_payment_saved.php
*/
public function testReSetPayment()
{
/** @var \Magento\Quote\Model\Quote $quote */
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId('test_order_1_with_payment');
$this->unAssignCustomerFromQuote('test_order_1_with_payment');
$methodCode = Checkmo::PAYMENT_METHOD_CHECKMO_CODE;
$query = $this->prepareMutationQuery($maskedQuoteId, $methodCode);
$response = $this->graphQlQuery($query);

self::assertArrayHasKey('setPaymentMethodOnCart', $response);
self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']);
self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']);
}

/**
* @param string $maskedQuoteId
* @param string $methodCode
Expand Down

0 comments on commit 8cde976

Please sign in to comment.