Skip to content

Commit c44df1c

Browse files
committed
GraphQL-631: Schema inconsistency of "Quantity / Qty" declaration
1 parent 109182e commit c44df1c

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/CartAddressTypeResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CartAddressTypeResolver implements TypeResolverInterface
2020
/**
2121
* @inheritdoc
2222
*/
23-
public function resolveType(array $data) : string
23+
public function resolveType(array $data): string
2424
{
2525
if (!isset($data['model'])) {
2626
throw new LocalizedException(__('Missing key "model" in cart address data'));
@@ -33,7 +33,7 @@ public function resolveType(array $data) : string
3333
} elseif ($address->getAddressType() == AbstractAddress::TYPE_BILLING) {
3434
$addressType = 'BillingCartAddress';
3535
} else {
36-
throw new LocalizedException( __('Unsupported cart address type'));
36+
throw new LocalizedException(__('Unsupported cart address type'));
3737
}
3838
return $addressType;
3939
}

dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public function testAddMoreProductsThatAllowed()
7171
* @expectedException \Exception
7272
* @expectedExceptionMessage Please enter a number greater than 0 in this field.
7373
*/
74-
public function testAddSimpleProductToCartWithNegativeQty()
74+
public function testAddSimpleProductToCartWithNegativeQuantity()
7575
{
7676
$sku = 'simple';
77-
$qty = -2;
77+
$quantity = -2;
7878
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
7979

80-
$query = $this->getQuery($maskedQuoteId, $sku, $qty);
80+
$query = $this->getQuery($maskedQuoteId, $sku, $quantity);
8181
$this->graphQlMutation($query);
8282
}
8383

@@ -88,10 +88,10 @@ public function testAddSimpleProductToCartWithNegativeQty()
8888
public function testAddProductIfQuantityIsDecimal()
8989
{
9090
$sku = 'simple_product';
91-
$qty = 0.2;
91+
$quantity = 0.2;
9292

9393
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
94-
$query = $this->getQuery($maskedQuoteId, $sku, $qty);
94+
$query = $this->getQuery($maskedQuoteId, $sku, $quantity);
9595

9696
$this->expectExceptionMessage(
9797
"Could not add the product with SKU {$sku} to the shopping cart: The fewest you may purchase is 1"
@@ -102,10 +102,10 @@ public function testAddProductIfQuantityIsDecimal()
102102
/**
103103
* @param string $maskedQuoteId
104104
* @param string $sku
105-
* @param float $qty
105+
* @param float $quantity
106106
* @return string
107107
*/
108-
private function getQuery(string $maskedQuoteId, string $sku, float $qty) : string
108+
private function getQuery(string $maskedQuoteId, string $sku, float $quantity) : string
109109
{
110110
return <<<QUERY
111111
mutation {
@@ -115,7 +115,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $qty) : stri
115115
cartItems: [
116116
{
117117
data: {
118-
quantity: $qty
118+
quantity: $quantity
119119
sku: "$sku"
120120
}
121121
}

dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/UpdateCartItemsTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ protected function setUp()
4141
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
4242
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
4343
*/
44-
public function testUpdateCartItemDecimalQty()
44+
public function testUpdateCartItemDecimalQuantity()
4545
{
4646
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
4747
$itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
4848

49-
$qty = 0.5;
49+
$quantity = 0.5;
5050
$this->expectExceptionMessage(
5151
"Could not update the product with SKU simple_product: The fewest you may purchase is 1"
5252
);
53-
$query = $this->getQuery($maskedQuoteId, $itemId, $qty);
53+
$query = $this->getQuery($maskedQuoteId, $itemId, $quantity);
5454
$this->graphQlMutation($query);
5555
}
5656

5757
/**
5858
* @param string $maskedQuoteId
5959
* @param int $itemId
60-
* @param float $qty
60+
* @param float $quantity
6161
* @return string
6262
*/
63-
private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string
63+
private function getQuery(string $maskedQuoteId, int $itemId, float $quantity): string
6464
{
6565
return <<<QUERY
6666
mutation {
@@ -69,14 +69,14 @@ private function getQuery(string $maskedQuoteId, int $itemId, float $qty): strin
6969
cart_items:[
7070
{
7171
cart_item_id: {$itemId}
72-
quantity: {$qty}
72+
quantity: {$quantity}
7373
}
7474
]
7575
}) {
7676
cart {
7777
items {
7878
id
79-
qty
79+
quantity
8080
}
8181
}
8282
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedBillingAddressTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet()
100100
'label' => null,
101101
],
102102
'telephone' => null,
103-
'__typename' => 'BillingCartAddress',
103+
'__typename' => null,
104104
];
105105
self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']);
106106
}

0 commit comments

Comments
 (0)