|
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 | {
|
@@ -287,7 +288,7 @@ public function dataProviderSetShippingMethodWithWrongParameters(): array
|
287 | 288 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
|
288 | 289 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
|
289 | 290 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
|
290 |
| - * @expectedException \Exception |
| 291 | + * @expectedException Exception |
291 | 292 | * @expectedExceptionMessage You cannot specify multiple shipping methods.
|
292 | 293 | */
|
293 | 294 | public function testSetMultipleShippingMethods()
|
@@ -333,7 +334,7 @@ public function testSetMultipleShippingMethods()
|
333 | 334 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
|
334 | 335 | * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
|
335 | 336 | *
|
336 |
| - * @expectedException \Exception |
| 337 | + * @expectedException Exception |
337 | 338 | */
|
338 | 339 | public function testSetShippingMethodToCustomerCart()
|
339 | 340 | {
|
@@ -381,6 +382,30 @@ public function testSetShippingMethodIfGuestIsNotOwnerOfAddress()
|
381 | 382 | $this->graphQlQuery($query);
|
382 | 383 | }
|
383 | 384 |
|
| 385 | + /** |
| 386 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php |
| 387 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php |
| 388 | + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/quote_with_address.php |
| 389 | + * |
| 390 | + * @expectedException Exception |
| 391 | + * @expectedExceptionMessage The shipping method can't be set for an empty cart. Add an item to cart and try again. |
| 392 | + */ |
| 393 | + public function testSetShippingMethodOnAnEmptyCart() |
| 394 | + { |
| 395 | + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); |
| 396 | + $carrierCode = 'flatrate'; |
| 397 | + $methodCode = 'flatrate'; |
| 398 | + $quoteAddressId = $this->getQuoteShippingAddressIdByReservedQuoteId->execute('test_quote'); |
| 399 | + |
| 400 | + $query = $this->getQuery( |
| 401 | + $maskedQuoteId, |
| 402 | + $methodCode, |
| 403 | + $carrierCode, |
| 404 | + $quoteAddressId |
| 405 | + ); |
| 406 | + $this->graphQlQuery($query); |
| 407 | + } |
| 408 | + |
384 | 409 | /**
|
385 | 410 | * @param string $maskedQuoteId
|
386 | 411 | * @param string $shippingMethodCode
|
|
0 commit comments