-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4115 from magento-engcom/graphql-develop-prs
[EngCom] Public Pull Requests - GraphQL
- Loading branch information
Showing
18 changed files
with
507 additions
and
369 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
83 changes: 0 additions & 83 deletions
83
app/code/Magento/QuoteGraphQl/Model/Cart/GetQuoteAddress.php
This file was deleted.
Oops, something went wrong.
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
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
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
86 changes: 86 additions & 0 deletions
86
dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\CatalogInventory; | ||
|
||
use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId; | ||
use Magento\GraphQl\Quote\GetQuoteItemIdByReservedQuoteIdAndSku; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
|
||
/** | ||
* Test for updating/removing shopping cart items | ||
*/ | ||
class UpdateCartItemsTest extends GraphQlAbstract | ||
{ | ||
/** | ||
* @var GetMaskedQuoteIdByReservedOrderId | ||
*/ | ||
private $getMaskedQuoteIdByReservedOrderId; | ||
|
||
/** | ||
* @var GetQuoteItemIdByReservedQuoteIdAndSku | ||
*/ | ||
private $getQuoteItemIdByReservedQuoteIdAndSku; | ||
|
||
protected function setUp() | ||
{ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class); | ||
$this->getQuoteItemIdByReservedQuoteIdAndSku = $objectManager->get( | ||
GetQuoteItemIdByReservedQuoteIdAndSku::class | ||
); | ||
} | ||
|
||
/** | ||
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php | ||
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php | ||
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php | ||
*/ | ||
public function testUpdateCartItemDecimalQty() | ||
{ | ||
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); | ||
$itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product'); | ||
|
||
$qty = 0.5; | ||
$this->expectExceptionMessage( | ||
"Could not update the product with SKU simple_product: The fewest you may purchase is 1" | ||
); | ||
$query = $this->getQuery($maskedQuoteId, $itemId, $qty); | ||
$this->graphQlMutation($query); | ||
} | ||
|
||
/** | ||
* @param string $maskedQuoteId | ||
* @param int $itemId | ||
* @param float $qty | ||
* @return string | ||
*/ | ||
private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string | ||
{ | ||
return <<<QUERY | ||
mutation { | ||
updateCartItems(input: { | ||
cart_id: "{$maskedQuoteId}" | ||
cart_items:[ | ||
{ | ||
cart_item_id: {$itemId} | ||
quantity: {$qty} | ||
} | ||
] | ||
}) { | ||
cart { | ||
items { | ||
id | ||
qty | ||
} | ||
} | ||
} | ||
} | ||
QUERY; | ||
} | ||
} |
Oops, something went wrong.