11
11
use Magento \Checkout \Api \Data \ShippingInformationInterfaceFactory ;
12
12
use Magento \Customer \Api \CustomerRepositoryInterface ;
13
13
use Magento \Framework \Api \SearchCriteriaBuilder ;
14
+ use Magento \Framework \Exception \InputException ;
14
15
use Magento \Quote \Api \CartRepositoryInterface ;
15
16
use Magento \Quote \Api \Data \ShippingAssignmentInterface ;
16
17
use Magento \TestFramework \Helper \Bootstrap ;
@@ -53,6 +54,9 @@ class GuestShippingInformationManagementTest extends TestCase
53
54
*/
54
55
private $ maskFactory ;
55
56
57
+ /**
58
+ * @inheritdoc
59
+ */
56
60
protected function setUp ()
57
61
{
58
62
$ objectManager = Bootstrap::getObjectManager ();
@@ -73,10 +77,8 @@ protected function setUp()
73
77
* @magentoDataFixture Magento/Sales/_files/quote.php
74
78
* @magentoDataFixture Magento/Customer/_files/customer_with_addresses.php
75
79
* @dataProvider getAddressesVariation
76
- * @expectedException \Magento\Framework\Exception\InputException
77
- * @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again.
78
80
*/
79
- public function testDifferentAddresses (bool $ swapShipping )
81
+ public function testDifferentAddresses (bool $ swapShipping ): void
80
82
{
81
83
$ carts = $ this ->cartRepo ->getList (
82
84
$ this ->searchCriteria ->addFilter ('reserved_order_id ' , 'test01 ' )->create ()
@@ -107,6 +109,14 @@ public function testDifferentAddresses(bool $swapShipping)
107
109
/** @var QuoteIdMask $idMask */
108
110
$ idMask = $ this ->maskFactory ->create ();
109
111
$ idMask ->load ($ cart ->getId (), 'quote_id ' );
112
+
113
+ $ this ->expectExceptionMessage (
114
+ sprintf (
115
+ 'The shipping information was unable to be saved. Error: "Invalid customer address id %s" ' ,
116
+ $ address ->getCustomerAddressId ()
117
+ )
118
+ );
119
+ $ this ->expectException (InputException::class);
110
120
$ this ->management ->saveAddressInformation ($ idMask ->getMaskedId (), $ shippingInformation );
111
121
}
112
122
0 commit comments