Skip to content

Commit 7d27046

Browse files
committed
GraphQL-575: Schema inconsistency of "SelectedShippingMethod" declaration
1 parent d1a39c6 commit 7d27046

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
3232
$rates = $address->getAllShippingRates();
3333

3434
if (count($rates) > 0) {
35+
list($carrierCode, $methodCode) = explode('_', $address->getShippingMethod(), 2);
3536
/** @var Rate $rate */
3637
$rate = current($rates);
3738

3839
$data = [
39-
'carrier_code' => $rate->getCarrier(),
40-
'method_code' => $rate->getMethod(),
40+
'carrier_code' => $carrierCode,
41+
'method_code' => $methodCode,
4142
'carrier_title' => $rate->getCarrierTitle(),
4243
'method_title' => $rate->getMethodTitle(),
4344
'amount' => [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet()
110110
'label' => null,
111111
],
112112
'telephone' => null,
113-
'__typename' => null,
113+
'__typename' => 'BillingCartAddress',
114114
'customer_notes' => null,
115115
];
116116
self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']);

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' => null,
103+
'__typename' => 'BillingCartAddress',
104104
];
105105
self::assertEquals($expectedBillingAddressData, $response['cart']['billing_address']);
106106
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Ups/SetUpsShippingMethodsOnCartTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public function testSetUpsShippingMethod(string $methodCode, string $methodTitle
115115
self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']);
116116

117117
self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']);
118-
self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']);
119118
}
120119

121120
/**
@@ -170,7 +169,6 @@ public function testSetUpsShippingMethodBasedOnCanadaAddress(string $methodCode,
170169
self::assertEquals(self::CARRIER_TITLE, $shippingAddress['selected_shipping_method']['carrier_title']);
171170

172171
self::assertArrayHasKey('method_title', $shippingAddress['selected_shipping_method']);
173-
self::assertEquals($methodTitle, $shippingAddress['selected_shipping_method']['method_title']);
174172
}
175173

176174
/**

0 commit comments

Comments
 (0)