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

Commit

Permalink
ENGCOM-4495: graphQl-430: added testReSetPaymentMethod for guest and …
Browse files Browse the repository at this point in the history
…customer #471
  • Loading branch information
naydav authored Mar 13, 2019
2 parents 0de07f4 + 8cde976 commit 4b841c2
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 4b841c2

Please sign in to comment.