7
7
8
8
namespace Magento \GraphQl \Quote \Customer ;
9
9
10
+ use Exception ;
10
11
use Magento \GraphQl \Quote \GetMaskedQuoteIdByReservedOrderId ;
11
12
use Magento \Integration \Api \CustomerTokenServiceInterface ;
12
13
use Magento \OfflinePayments \Model \Cashondelivery ;
13
14
use Magento \OfflinePayments \Model \Checkmo ;
15
+ use Magento \OfflinePayments \Model \Purchaseorder ;
14
16
use Magento \TestFramework \Helper \Bootstrap ;
15
17
use Magento \TestFramework \TestCase \GraphQlAbstract ;
16
18
@@ -66,7 +68,7 @@ public function testSetPaymentOnCartWithSimpleProduct()
66
68
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
67
69
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
68
70
*
69
- * @expectedException \ Exception
71
+ * @expectedException Exception
70
72
* @expectedExceptionMessage The shipping address is missing. Set the address and try again.
71
73
*/
72
74
public function testSetPaymentOnCartWithSimpleProductAndWithoutAddress ()
@@ -105,7 +107,7 @@ public function testSetPaymentOnCartWithVirtualProduct()
105
107
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
106
108
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
107
109
*
108
- * @expectedException \ Exception
110
+ * @expectedException Exception
109
111
* @expectedExceptionMessage The requested Payment Method is not available.
110
112
*/
111
113
public function testSetNonExistentPaymentMethod ()
@@ -120,7 +122,7 @@ public function testSetNonExistentPaymentMethod()
120
122
/**
121
123
* @magentoApiDataFixture Magento/Customer/_files/customer.php
122
124
*
123
- * @expectedException \ Exception
125
+ * @expectedException Exception
124
126
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
125
127
*/
126
128
public function testSetPaymentOnNonExistentCart ()
@@ -180,7 +182,7 @@ public function testSetPaymentMethodToAnotherCustomerCart()
180
182
*
181
183
* @param string $input
182
184
* @param string $message
183
- * @throws \ Exception
185
+ * @throws Exception
184
186
* @dataProvider dataProviderSetPaymentMethodWithoutRequiredParameters
185
187
*/
186
188
public function testSetPaymentMethodWithoutRequiredParameters (string $ input , string $ message )
@@ -204,6 +206,24 @@ public function testSetPaymentMethodWithoutRequiredParameters(string $input, str
204
206
$ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
205
207
}
206
208
209
+ /**
210
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
211
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
212
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
213
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
214
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
215
+ * @expectedException Exception
216
+ * @expectedExceptionMessage The requested Payment Method is not available.
217
+ */
218
+ public function testSetDisabledPaymentOnCart ()
219
+ {
220
+ $ methodCode = Purchaseorder::PAYMENT_METHOD_PURCHASEORDER_CODE ;
221
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
222
+
223
+ $ query = $ this ->getQuery ($ maskedQuoteId , $ methodCode );
224
+ $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
225
+ }
226
+
207
227
/**
208
228
* @return array
209
229
*/
0 commit comments