@@ -54,11 +54,11 @@ protected function setUp()
54
54
/**
55
55
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_saved.php
56
56
*/
57
- public function testGetPaymentMethodsFromCustomerCart ()
57
+ public function testGetCartWithPaymentMethods ()
58
58
{
59
59
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ('test_order_item_with_items ' );
60
- $ query = $ this ->getCartAvailablePaymentMethodsQuery ($ maskedQuoteId );
61
- $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
60
+ $ query = $ this ->getQuery ($ maskedQuoteId );
61
+ $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
62
62
63
63
self ::assertArrayHasKey ('cart ' , $ response );
64
64
self ::assertEquals ('checkmo ' , $ response ['cart ' ]['available_payment_methods ' ][0 ]['code ' ]);
@@ -70,14 +70,31 @@ public function testGetPaymentMethodsFromCustomerCart()
70
70
);
71
71
}
72
72
73
+ /**
74
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
75
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
76
+ */
77
+ public function testGetPaymentMethodsFromGuestCart ()
78
+ {
79
+ $ guestQuoteMaskedId = $ this ->getMaskedQuoteIdByReservedOrderId (
80
+ 'test_order_with_virtual_product_without_address '
81
+ );
82
+ $ query = $ this ->getQuery ($ guestQuoteMaskedId );
83
+
84
+ $ this ->expectExceptionMessage (
85
+ "The current user cannot perform operations on cart \"$ guestQuoteMaskedId \""
86
+ );
87
+ $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
88
+ }
89
+
73
90
/**
74
91
* @magentoApiDataFixture Magento/Customer/_files/three_customers.php
75
92
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_saved.php
76
93
*/
77
94
public function testGetPaymentMethodsFromAnotherCustomerCart ()
78
95
{
79
96
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ('test_order_item_with_items ' );
80
- $ query = $ this ->getCartAvailablePaymentMethodsQuery ($ maskedQuoteId );
97
+ $ query = $ this ->getQuery ($ maskedQuoteId );
81
98
82
99
$ this ->expectExceptionMessage (
83
100
"The current user cannot perform operations on cart \"$ maskedQuoteId \""
@@ -92,8 +109,8 @@ public function testGetPaymentMethodsFromAnotherCustomerCart()
92
109
public function testGetPaymentMethodsIfPaymentsAreNotSet ()
93
110
{
94
111
$ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ('test_order_item_with_items ' );
95
- $ query = $ this ->getCartAvailablePaymentMethodsQuery ($ maskedQuoteId );
96
- $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
112
+ $ query = $ this ->getQuery ($ maskedQuoteId );
113
+ $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
97
114
98
115
self ::assertEquals (0 , count ($ response ['cart ' ]['available_payment_methods ' ]));
99
116
}
@@ -106,7 +123,7 @@ public function testGetPaymentMethodsIfPaymentsAreNotSet()
106
123
public function testGetPaymentMethodsOfNonExistentCart ()
107
124
{
108
125
$ maskedQuoteId = 'non_existent_masked_id ' ;
109
- $ query = $ this ->getCartAvailablePaymentMethodsQuery ($ maskedQuoteId );
126
+ $ query = $ this ->getQuery ($ maskedQuoteId );
110
127
111
128
$ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
112
129
}
@@ -115,9 +132,10 @@ public function testGetPaymentMethodsOfNonExistentCart()
115
132
* @param string $maskedQuoteId
116
133
* @return string
117
134
*/
118
- private function getCartAvailablePaymentMethodsQuery (
135
+ private function getQuery (
119
136
string $ maskedQuoteId
120
- ) : string {
137
+ ): string
138
+ {
121
139
return <<<QUERY
122
140
{
123
141
cart(cart_id: " $ maskedQuoteId") {
0 commit comments