3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
- declare (strict_types= 1 );
6
+ declare (strict_types = 1 );
7
7
8
8
namespace Magento \GraphQl \Quote \Customer ;
9
9
@@ -44,11 +44,11 @@ class GetAvailableShippingMethodsTest extends GraphQlAbstract
44
44
*/
45
45
protected function setUp ()
46
46
{
47
- $ objectManager = Bootstrap::getObjectManager ();
48
- $ this ->quoteFactory = $ objectManager ->get (QuoteFactory::class);
49
- $ this ->quoteResource = $ objectManager ->create (QuoteResource::class);
47
+ $ objectManager = Bootstrap::getObjectManager ();
48
+ $ this ->quoteFactory = $ objectManager ->get (QuoteFactory::class);
49
+ $ this ->quoteResource = $ objectManager ->create (QuoteResource::class);
50
50
$ this ->customerTokenService = $ objectManager ->get (CustomerTokenServiceInterface::class);
51
- $ this ->quoteIdToMaskedId = $ objectManager ->create (QuoteIdToMaskedQuoteIdInterface::class);
51
+ $ this ->quoteIdToMaskedId = $ objectManager ->create (QuoteIdToMaskedQuoteIdInterface::class);
52
52
}
53
53
54
54
/**
@@ -59,7 +59,7 @@ protected function setUp()
59
59
public function testGetAvailableShippingMethods ()
60
60
{
61
61
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ('test_order_1 ' );
62
- $ response = $ this ->graphQlQuery ($ this ->getQuery ($ maskedQuoteId ), [], '' , $ this ->getHeaderMap ());
62
+ $ response = $ this ->graphQlQuery ($ this ->getAvailableShippingMethodsQuery ($ maskedQuoteId ), [], '' , $ this ->getHeaderMap ());
63
63
64
64
self ::assertArrayHasKey ('cart ' , $ response );
65
65
self ::assertArrayHasKey ('shipping_addresses ' , $ response ['cart ' ]);
@@ -68,13 +68,13 @@ public function testGetAvailableShippingMethods()
68
68
self ::assertCount (1 , $ response ['cart ' ]['shipping_addresses ' ][0 ]['available_shipping_methods ' ]);
69
69
70
70
$ expectedAddressData = [
71
- 'amount ' => 10 ,
72
- 'base_amount ' => 10 ,
73
- 'carrier_code ' => 'flatrate ' ,
74
- 'carrier_title ' => 'Flat Rate ' ,
75
- 'error_message ' => '' ,
76
- 'method_code ' => 'flatrate ' ,
77
- 'method_title ' => 'Fixed ' ,
71
+ 'amount ' => 10 ,
72
+ 'base_amount ' => 10 ,
73
+ 'carrier_code ' => 'flatrate ' ,
74
+ 'carrier_title ' => 'Flat Rate ' ,
75
+ 'error_message ' => '' ,
76
+ 'method_code ' => 'flatrate ' ,
77
+ 'method_title ' => 'Fixed ' ,
78
78
'price_incl_tax ' => 10 ,
79
79
'price_excl_tax ' => 10 ,
80
80
];
@@ -98,7 +98,7 @@ public function testGetAvailableShippingMethodsFromAnotherCustomerCart()
98
98
"The current user cannot perform operations on cart \"$ maskedQuoteId \""
99
99
);
100
100
101
- $ this ->
graphQlQuery (
$ this ->
getQuery (
$ maskedQuoteId), [],
'' ,
$ this ->
getHeaderMap (
'[email protected] ' ));
101
+ $ this ->
graphQlQuery (
$ this ->
getAvailableShippingMethodsQuery (
$ maskedQuoteId), [],
'' ,
$ this ->
getHeaderMap (
'[email protected] ' ));
102
102
}
103
103
104
104
/**
@@ -110,7 +110,7 @@ public function testGetAvailableShippingMethodsFromAnotherCustomerCart()
110
110
public function testGetAvailableShippingMethodsIfShippingsAreNotSet ()
111
111
{
112
112
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ('test_order_1 ' );
113
- $ response = $ this ->graphQlQuery ($ this ->getQuery ($ maskedQuoteId ), [], '' , $ this ->getHeaderMap ());
113
+ $ response = $ this ->graphQlQuery ($ this ->getAvailableShippingMethodsQuery ($ maskedQuoteId ), [], '' , $ this ->getHeaderMap ());
114
114
115
115
self ::assertEquals (0 , count ($ response ['cart ' ]['shipping_addresses ' ][0 ]['available_shipping_methods ' ]));
116
116
}
@@ -125,7 +125,7 @@ public function testGetAvailableShippingMethodsIfShippingsAreNotSet()
125
125
public function testGetAvailableShippingMethodsOfNonExistentCart ()
126
126
{
127
127
$ maskedQuoteId = 'non_existent_masked_id ' ;
128
- $ query = $ this ->getQuery ($ maskedQuoteId );
128
+ $ query = $ this ->getAvailableShippingMethodsQuery ($ maskedQuoteId );
129
129
130
130
$ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
131
131
}
@@ -134,9 +134,10 @@ public function testGetAvailableShippingMethodsOfNonExistentCart()
134
134
* @param string $maskedQuoteId
135
135
* @return string
136
136
*/
137
- private function getQuery (
137
+ private function getAvailableShippingMethodsQuery (
138
138
string $ maskedQuoteId
139
- ): string {
139
+ ): string
140
+ {
140
141
return <<<QUERY
141
142
query {
142
143
cart (cart_id: " {$ maskedQuoteId }") {
0 commit comments