Skip to content

Commit 4013a39

Browse files
author
Vitaliy Boyko
committed
graphQl-889: fixed tests
1 parent ff0e6c0 commit 4013a39

File tree

6 files changed

+4
-57
lines changed

6 files changed

+4
-57
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
7575
);
7676
$methods[] = $this->processMoneyTypeData(
7777
$methodData,
78-
$cart->getQuoteCurrencyCode(),
79-
$context->getExtensionAttributes()->getStore()
78+
$cart->getQuoteCurrencyCode()
8079
);
8180
}
8281
}
@@ -88,11 +87,10 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8887
*
8988
* @param array $data
9089
* @param string $quoteCurrencyCode
91-
* @param StoreInterface $store
9290
* @return array
9391
* @throws NoSuchEntityException
9492
*/
95-
private function processMoneyTypeData(array $data, string $quoteCurrencyCode, StoreInterface $store): array
93+
private function processMoneyTypeData(array $data, string $quoteCurrencyCode): array
9694
{
9795
if (isset($data['amount'])) {
9896
$data['amount'] = ['value' => $data['amount'], 'currency' => $quoteCurrencyCode];

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
4646
}
4747
}
4848

49-
/** @var Currency $currency */
50-
$currency = $context->getExtensionAttributes()->getStore()->getBaseCurrency();
51-
5249
$data = [
5350
'carrier_code' => $carrierCode,
5451
'method_code' => $methodCode,

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ protected function setUp()
5353
* @param string $carrierTitle
5454
* @param string $methodTitle
5555
* @param array $amount
56-
* @param array $baseAmount
5756
* @throws \Magento\Framework\Exception\NoSuchEntityException
5857
* @dataProvider offlineShippingMethodDataProvider
5958
*/
@@ -62,8 +61,7 @@ public function testSetOfflineShippingMethod(
6261
string $methodCode,
6362
string $carrierTitle,
6463
string $methodTitle,
65-
array $amount,
66-
array $baseAmount
64+
array $amount
6765
) {
6866
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
6967

@@ -96,9 +94,6 @@ public function testSetOfflineShippingMethod(
9694

9795
self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']);
9896
self::assertEquals($amount, $shippingAddress['selected_shipping_method']['amount']);
99-
100-
self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']);
101-
self::assertEquals($baseAmount, $shippingAddress['selected_shipping_method']['base_amount']);
10297
}
10398

10499
/**
@@ -113,23 +108,20 @@ public function offlineShippingMethodDataProvider(): array
113108
'Flat Rate',
114109
'Fixed',
115110
['value' => 10, 'currency' => 'USD'],
116-
['value' => 10, 'currency' => 'USD'],
117111
],
118112
'tablerate_bestway' => [
119113
'tablerate',
120114
'bestway',
121115
'Best Way',
122116
'Table Rate',
123117
['value' => 10, 'currency' => 'USD'],
124-
['value' => 10, 'currency' => 'USD'],
125118
],
126119
'freeshipping_freeshipping' => [
127120
'freeshipping',
128121
'freeshipping',
129122
'Free Shipping',
130123
'Free',
131124
['value' => 0, 'currency' => 'USD'],
132-
['value' => 0, 'currency' => 'USD'],
133125
],
134126
];
135127
}
@@ -166,10 +158,6 @@ private function getQuery(
166158
value
167159
currency
168160
}
169-
base_amount {
170-
value
171-
currency
172-
}
173161
}
174162
}
175163
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,6 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
8585
self::assertEquals(10, $amount['value']);
8686
self::assertArrayHasKey('currency', $amount);
8787
self::assertEquals('USD', $amount['currency']);
88-
89-
self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']);
90-
$baseAmount = $shippingAddress['selected_shipping_method']['base_amount'];
91-
92-
self::assertArrayHasKey('value', $baseAmount);
93-
self::assertEquals(10, $baseAmount['value']);
94-
self::assertArrayHasKey('currency', $baseAmount);
95-
self::assertEquals('USD', $baseAmount['currency']);
9688
}
9789

9890
/**
@@ -379,10 +371,6 @@ private function getQuery(
379371
value
380372
currency
381373
}
382-
base_amount {
383-
value
384-
currency
385-
}
386374
}
387375
}
388376
}

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ protected function setUp()
4545
* @param string $carrierTitle
4646
* @param string $methodTitle
4747
* @param array $amount
48-
* @param array $baseAmount
4948
* @throws \Magento\Framework\Exception\NoSuchEntityException
5049
* @dataProvider offlineShippingMethodDataProvider
5150
*/
@@ -54,8 +53,7 @@ public function testSetOfflineShippingMethod(
5453
string $methodCode,
5554
string $carrierTitle,
5655
string $methodTitle,
57-
array $amount,
58-
array $baseAmount
56+
array $amount
5957
) {
6058
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
6159

@@ -88,9 +86,6 @@ public function testSetOfflineShippingMethod(
8886

8987
self::assertArrayHasKey('amount', $shippingAddress['selected_shipping_method']);
9088
self::assertEquals($amount, $shippingAddress['selected_shipping_method']['amount']);
91-
92-
self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']);
93-
self::assertEquals($baseAmount, $shippingAddress['selected_shipping_method']['base_amount']);
9489
}
9590

9691
/**
@@ -105,23 +100,20 @@ public function offlineShippingMethodDataProvider(): array
105100
'Flat Rate',
106101
'Fixed',
107102
['value' => 10, 'currency' => 'USD'],
108-
['value' => 10, 'currency' => 'USD'],
109103
],
110104
'tablerate_bestway' => [
111105
'tablerate',
112106
'bestway',
113107
'Best Way',
114108
'Table Rate',
115109
['value' => 10, 'currency' => 'USD'],
116-
['value' => 10, 'currency' => 'USD'],
117110
],
118111
'freeshipping_freeshipping' => [
119112
'freeshipping',
120113
'freeshipping',
121114
'Free Shipping',
122115
'Free',
123116
['value' => 0, 'currency' => 'USD'],
124-
['value' => 0, 'currency' => 'USD'],
125117
],
126118
];
127119
}
@@ -158,10 +150,6 @@ private function getQuery(
158150
value
159151
currency
160152
}
161-
base_amount {
162-
value
163-
currency
164-
}
165153
}
166154
}
167155
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
7777
self::assertEquals(10, $amount['value']);
7878
self::assertArrayHasKey('currency', $amount);
7979
self::assertEquals('USD', $amount['currency']);
80-
81-
self::assertArrayHasKey('base_amount', $shippingAddress['selected_shipping_method']);
82-
$baseAmount = $shippingAddress['selected_shipping_method']['base_amount'];
83-
84-
self::assertArrayHasKey('value', $baseAmount);
85-
self::assertEquals(10, $baseAmount['value']);
86-
self::assertArrayHasKey('currency', $baseAmount);
87-
self::assertEquals('USD', $baseAmount['currency']);
8880
}
8981

9082
/**
@@ -390,10 +382,6 @@ private function getQuery(
390382
value
391383
currency
392384
}
393-
base_amount {
394-
value
395-
currency
396-
}
397385
}
398386
}
399387
}

0 commit comments

Comments
 (0)