-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraphQL-432: Replaced the places are using getMaskedQuoteId as method…
…. Added new class to handle that.
- Loading branch information
Showing
11 changed files
with
137 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
namespace Magento\GraphQl\Quote\Customer; | ||
|
||
use Magento\Integration\Api\CustomerTokenServiceInterface; | ||
use Magento\QuoteGraphQl\Model\GetMaskedQuoteIdByReversedQuoteId; | ||
use Magento\Quote\Model\QuoteFactory; | ||
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; | ||
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; | ||
|
@@ -24,6 +25,11 @@ class GetAvailablePaymentMethodsTest extends GraphQlAbstract | |
*/ | ||
private $customerTokenService; | ||
|
||
/** | ||
* @var GetMaskedQuoteIdByReversedQuoteId | ||
*/ | ||
private $getMaskedQuoteIdByReversedQuoteId; | ||
|
||
/** | ||
* @var QuoteResource | ||
*/ | ||
|
@@ -45,6 +51,7 @@ class GetAvailablePaymentMethodsTest extends GraphQlAbstract | |
protected function setUp() | ||
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->getMaskedQuoteIdByReversedQuoteId = $objectManager->get(GetMaskedQuoteIdByReversedQuoteId::class); | ||
$this->quoteResource = $objectManager->get(QuoteResource::class); | ||
$this->quoteFactory = $objectManager->get(QuoteFactory::class); | ||
$this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class); | ||
|
@@ -53,10 +60,12 @@ protected function setUp() | |
|
||
/** | ||
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_saved.php | ||
* @throws \Exception | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function testGetCartWithPaymentMethods() | ||
{ | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId('test_order_item_with_items'); | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId->execute('test_order_item_with_items'); | ||
|
||
$query = <<<QUERY | ||
{ | ||
|
@@ -86,16 +95,4 @@ private function getHeaderMap(string $username = '[email protected]', string | |
$headerMap = ['Authorization' => 'Bearer ' . $customerToken]; | ||
return $headerMap; | ||
} | ||
|
||
/** | ||
* @param string $reversedQuoteId | ||
* @return string | ||
*/ | ||
private function getMaskedQuoteIdByReversedQuoteId(string $reversedQuoteId): string | ||
{ | ||
$quote = $this->quoteFactory->create(); | ||
$this->quoteResource->load($quote, $reversedQuoteId, 'reserved_order_id'); | ||
|
||
return $this->quoteIdToMaskedId->execute((int)$quote->getId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
namespace Magento\GraphQl\Quote\Customer; | ||
|
||
use Magento\Integration\Api\CustomerTokenServiceInterface; | ||
use Magento\QuoteGraphQl\Model\GetMaskedQuoteIdByReversedQuoteId; | ||
use Magento\Quote\Model\QuoteFactory; | ||
use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; | ||
use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; | ||
|
@@ -19,6 +20,11 @@ | |
*/ | ||
class SetBillingAddressOnCartTest extends GraphQlAbstract | ||
{ | ||
/** | ||
* @var GetMaskedQuoteIdByReversedQuoteId | ||
*/ | ||
private $getMaskedQuoteIdByReversedQuoteId; | ||
|
||
/** | ||
* @var QuoteResource | ||
*/ | ||
|
@@ -42,6 +48,7 @@ class SetBillingAddressOnCartTest extends GraphQlAbstract | |
protected function setUp() | ||
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->getMaskedQuoteIdByReversedQuoteId = $objectManager->get(GetMaskedQuoteIdByReversedQuoteId::class); | ||
$this->quoteResource = $objectManager->get(QuoteResource::class); | ||
$this->quoteFactory = $objectManager->get(QuoteFactory::class); | ||
$this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class); | ||
|
@@ -307,10 +314,12 @@ public function testSetNewBillingAddressAndFromAddressBookAtSameTime() | |
* @magentoApiDataFixture Magento/Customer/_files/customer.php | ||
* @magentoApiDataFixture Magento/Customer/_files/customer_address.php | ||
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php | ||
* @throws \Exception | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function testSetBillingAddressToGuestCart() | ||
{ | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId('test_order_with_simple_product_without_address'); | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReversedQuoteId->execute('test_order_with_simple_product_without_address'); | ||
|
||
$query = <<<QUERY | ||
mutation { | ||
|
@@ -459,18 +468,6 @@ private function getHeaderMap(string $username = '[email protected]', string | |
return $headerMap; | ||
} | ||
|
||
/** | ||
* @param string $reversedQuoteId | ||
* @return string | ||
*/ | ||
private function getMaskedQuoteIdByReversedQuoteId(string $reversedQuoteId): string | ||
{ | ||
$quote = $this->quoteFactory->create(); | ||
$this->quoteResource->load($quote, $reversedQuoteId, 'reserved_order_id'); | ||
|
||
return $this->quoteIdToMaskedId->execute((int)$quote->getId()); | ||
} | ||
|
||
/** | ||
* @param string $reversedQuoteId | ||
* @param int $customerId | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.