@@ -39,6 +39,7 @@ protected function setUp()
39
39
}
40
40
41
41
/**
42
+ * @magentoConfigFixture default_store carriers/freeshipping/active 1
42
43
* @magentoApiDataFixture Magento/Customer/_files/customer.php
43
44
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
44
45
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
@@ -64,7 +65,17 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
64
65
self ::assertCount (1 , $ response ['setShippingMethodsOnCart ' ]['cart ' ]['shipping_addresses ' ]);
65
66
66
67
$ shippingAddress = current ($ response ['setShippingMethodsOnCart ' ]['cart ' ]['shipping_addresses ' ]);
68
+ $ availableShippingMethods = $ shippingAddress ['available_shipping_methods ' ];
69
+
67
70
self ::assertArrayHasKey ('selected_shipping_method ' , $ shippingAddress );
71
+ self ::assertArrayHasKey ('available_shipping_methods ' , $ shippingAddress );
72
+
73
+ self ::assertCount (2 , $ availableShippingMethods );
74
+ self ::assertEquals ('freeshipping ' , $ availableShippingMethods [0 ]['carrier_code ' ]);
75
+ self ::assertEquals ($ carrierCode , $ availableShippingMethods [1 ]['carrier_code ' ]);
76
+
77
+ self ::assertEquals ($ availableShippingMethods [0 ]['amount ' ]['value ' ], 0 );
78
+ self ::assertEquals ($ availableShippingMethods [1 ]['amount ' ]['value ' ], 10 );
68
79
69
80
self ::assertArrayHasKey ('carrier_code ' , $ shippingAddress ['selected_shipping_method ' ]);
70
81
self ::assertEquals ('flatrate ' , $ shippingAddress ['selected_shipping_method ' ]['carrier_code ' ]);
@@ -146,7 +157,7 @@ public function testSetShippingMethodWithWrongParameters(string $input, string $
146
157
$ query = <<<QUERY
147
158
mutation {
148
159
setShippingMethodsOnCart(input: {
149
- {$ input }
160
+ {$ input }
150
161
}) {
151
162
cart {
152
163
shipping_addresses {
@@ -237,7 +248,7 @@ public function testSetMultipleShippingMethods()
237
248
$ query = <<<QUERY
238
249
mutation {
239
250
setShippingMethodsOnCart(input: {
240
- cart_id: " {$ maskedQuoteId }",
251
+ cart_id: " {$ maskedQuoteId }",
241
252
shipping_methods: [
242
253
{
243
254
carrier_code: "flatrate"
@@ -329,9 +340,9 @@ private function getQuery(
329
340
): string {
330
341
return <<<QUERY
331
342
mutation {
332
- setShippingMethodsOnCart(input:
343
+ setShippingMethodsOnCart(input:
333
344
{
334
- cart_id: " $ maskedQuoteId",
345
+ cart_id: " $ maskedQuoteId",
335
346
shipping_methods: [{
336
347
carrier_code: " $ shippingCarrierCode"
337
348
method_code: " $ shippingMethodCode"
@@ -349,6 +360,12 @@ private function getQuery(
349
360
currency
350
361
}
351
362
}
363
+ available_shipping_methods {
364
+ amount{
365
+ value
366
+ }
367
+ carrier_code
368
+ }
352
369
}
353
370
}
354
371
}
0 commit comments