-
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-428: Test coverage: GetAvailableShippingMethodsTest
- Loading branch information
Showing
4 changed files
with
32 additions
and
27 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
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 |
---|---|---|
|
@@ -46,9 +46,9 @@ protected function setUp() | |
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->quoteFactory = $objectManager->get(QuoteFactory::class); | ||
$this->quoteResource = $objectManager->create(QuoteResource::class); | ||
$this->quoteResource = $objectManager->get(QuoteResource::class); | ||
$this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class); | ||
$this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class); | ||
$this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class); | ||
} | ||
|
||
/** | ||
|
@@ -59,7 +59,7 @@ protected function setUp() | |
public function testGetAvailableShippingMethods() | ||
{ | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId('test_order_1'); | ||
$response = $this->graphQlQuery($this->getAvailableShippingMethodsQuery($maskedQuoteId), [], '', $this->getHeaderMap()); | ||
$response = $this->graphQlQuery($this->getQuery($maskedQuoteId), [], '', $this->getHeaderMap()); | ||
|
||
self::assertArrayHasKey('cart', $response); | ||
self::assertArrayHasKey('shipping_addresses', $response['cart']); | ||
|
@@ -98,7 +98,12 @@ public function testGetAvailableShippingMethodsFromAnotherCustomerCart() | |
"The current user cannot perform operations on cart \"$maskedQuoteId\"" | ||
); | ||
|
||
$this->graphQlQuery($this->getAvailableShippingMethodsQuery($maskedQuoteId), [], '', $this->getHeaderMap('[email protected]')); | ||
$this->graphQlQuery( | ||
$this->getQuery($maskedQuoteId), | ||
[], | ||
'', | ||
$this->getHeaderMap('[email protected]') | ||
); | ||
} | ||
|
||
/** | ||
|
@@ -107,10 +112,10 @@ public function testGetAvailableShippingMethodsFromAnotherCustomerCart() | |
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php | ||
* @magentoApiDataFixture Magento/OfflineShipping/_files/disable_offline_shipping_methods.php | ||
*/ | ||
public function testGetAvailableShippingMethodsIfShippingsAreNotSet() | ||
public function testGetAvailableShippingMethodsIfAllShippingsAreDisabled() | ||
{ | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId('test_order_1'); | ||
$response = $this->graphQlQuery($this->getAvailableShippingMethodsQuery($maskedQuoteId), [], '', $this->getHeaderMap()); | ||
$response = $this->graphQlQuery($this->getQuery($maskedQuoteId), [], '', $this->getHeaderMap()); | ||
|
||
self::assertEquals(0, count($response['cart']['shipping_addresses'][0]['available_shipping_methods'])); | ||
} | ||
|
@@ -125,7 +130,7 @@ public function testGetAvailableShippingMethodsIfShippingsAreNotSet() | |
public function testGetAvailableShippingMethodsOfNonExistentCart() | ||
{ | ||
$maskedQuoteId = 'non_existent_masked_id'; | ||
$query = $this->getAvailableShippingMethodsQuery($maskedQuoteId); | ||
$query = $this->getQuery($maskedQuoteId); | ||
|
||
$this->graphQlQuery($query, [], '', $this->getHeaderMap()); | ||
} | ||
|
@@ -134,7 +139,7 @@ public function testGetAvailableShippingMethodsOfNonExistentCart() | |
* @param string $maskedQuoteId | ||
* @return string | ||
*/ | ||
private function getAvailableShippingMethodsQuery( | ||
private function getQuery( | ||
string $maskedQuoteId | ||
): string | ||
{ | ||
|
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