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

graphQl-430: added testReSetPaymentMethod for guest and customer #471

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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