|
7 | 7 |
|
8 | 8 | namespace Magento\GraphQl\Quote\Guest;
|
9 | 9 |
|
| 10 | +use Exception; |
10 | 11 | use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
|
11 | 12 | use Magento\GraphQl\Quote\GetQuoteShippingAddressIdByReservedQuoteId;
|
12 | 13 | use Magento\TestFramework\Helper\Bootstrap;
|
@@ -85,7 +86,7 @@ public function testSetShippingMethodOnCartWithSimpleProduct()
|
85 | 86 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
|
86 | 87 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_virtual_product.php
|
87 | 88 | *
|
88 |
| - * @expectedException \Exception |
| 89 | + * @expectedException Exception |
89 | 90 | * @expectedExceptionMessage The shipping address is missing. Set the address and try again.
|
90 | 91 | */
|
91 | 92 | public function testSetShippingMethodOnCartWithSimpleProductAndWithoutAddress()
|
@@ -151,7 +152,7 @@ public function testReSetShippingMethod()
|
151 | 152 | * @param string $input
|
152 | 153 | * @param string $message
|
153 | 154 | * @dataProvider dataProviderSetShippingMethodWithWrongParameters
|
154 |
| - * @throws \Exception |
| 155 | + * @throws Exception |
155 | 156 | */
|
156 | 157 | public function testSetShippingMethodWithWrongParameters(string $input, string $message)
|
157 | 158 | {
|
@@ -279,7 +280,7 @@ public function dataProviderSetShippingMethodWithWrongParameters(): array
|
279 | 280 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
|
280 | 281 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
|
281 | 282 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
|
282 |
| - * @expectedException \Exception |
| 283 | + * @expectedException Exception |
283 | 284 | * @expectedExceptionMessage You cannot specify multiple shipping methods.
|
284 | 285 | */
|
285 | 286 | public function testSetMultipleShippingMethods()
|
@@ -325,7 +326,7 @@ public function testSetMultipleShippingMethods()
|
325 | 326 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
|
326 | 327 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
|
327 | 328 | *
|
328 |
| - * @expectedException \Exception |
| 329 | + * @expectedException Exception |
329 | 330 | */
|
330 | 331 | public function testSetShippingMethodToCustomerCart()
|
331 | 332 | {
|
@@ -373,6 +374,30 @@ public function testSetShippingMethodIfGuestIsNotOwnerOfAddress()
|
373 | 374 | $this->graphQlQuery($query);
|
374 | 375 | }
|
375 | 376 |
|
| 377 | + /** |
| 378 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php |
| 379 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php |
| 380 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/quote_with_address.php |
| 381 | + * |
| 382 | + * @expectedException Exception |
| 383 | + * @expectedExceptionMessage The shipping method can't be set for an empty cart. Add an item to cart and try again. |
| 384 | + */ |
| 385 | + public function testSetShippingMethodOnAnEmptyCart() |
| 386 | + { |
| 387 | + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); |
| 388 | + $carrierCode = 'flatrate'; |
| 389 | + $methodCode = 'flatrate'; |
| 390 | + $quoteAddressId = $this->getQuoteShippingAddressIdByReservedQuoteId->execute('test_quote'); |
| 391 | + |
| 392 | + $query = $this->getQuery( |
| 393 | + $maskedQuoteId, |
| 394 | + $methodCode, |
| 395 | + $carrierCode, |
| 396 | + $quoteAddressId |
| 397 | + ); |
| 398 | + $this->graphQlQuery($query); |
| 399 | + } |
| 400 | + |
376 | 401 | /**
|
377 | 402 | * @param string $maskedQuoteId
|
378 | 403 | * @param string $shippingMethodCode
|
|
0 commit comments