Skip to content

Commit a6e0b3e

Browse files
fix integration tests
1 parent 2668433 commit a6e0b3e

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

dev/tests/integration/testsuite/Magento/Checkout/Api/GuestShippingInformationManagementTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Checkout\Api\Data\ShippingInformationInterfaceFactory;
1212
use Magento\Customer\Api\CustomerRepositoryInterface;
1313
use Magento\Framework\Api\SearchCriteriaBuilder;
14+
use Magento\Framework\Exception\InputException;
1415
use Magento\Quote\Api\CartRepositoryInterface;
1516
use Magento\Quote\Api\Data\ShippingAssignmentInterface;
1617
use Magento\TestFramework\Helper\Bootstrap;
@@ -53,6 +54,9 @@ class GuestShippingInformationManagementTest extends TestCase
5354
*/
5455
private $maskFactory;
5556

57+
/**
58+
* @inheritdoc
59+
*/
5660
protected function setUp()
5761
{
5862
$objectManager = Bootstrap::getObjectManager();
@@ -73,10 +77,8 @@ protected function setUp()
7377
* @magentoDataFixture Magento/Sales/_files/quote.php
7478
* @magentoDataFixture Magento/Customer/_files/customer_with_addresses.php
7579
* @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.
7880
*/
79-
public function testDifferentAddresses(bool $swapShipping)
81+
public function testDifferentAddresses(bool $swapShipping): void
8082
{
8183
$carts = $this->cartRepo->getList(
8284
$this->searchCriteria->addFilter('reserved_order_id', 'test01')->create()
@@ -107,6 +109,14 @@ public function testDifferentAddresses(bool $swapShipping)
107109
/** @var QuoteIdMask $idMask */
108110
$idMask = $this->maskFactory->create();
109111
$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);
110120
$this->management->saveAddressInformation($idMask->getMaskedId(), $shippingInformation);
111121
}
112122

dev/tests/integration/testsuite/Magento/Checkout/Api/ShippingInformationManagementTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Quote\Api\CartRepositoryInterface;
1414
use Magento\Quote\Api\Data\ShippingAssignmentInterface;
1515
use Magento\TestFramework\Helper\Bootstrap;
16+
use Magento\Framework\Exception\InputException;
1617
use PHPUnit\Framework\TestCase;
1718

1819
/**
@@ -40,6 +41,9 @@ class ShippingInformationManagementTest extends TestCase
4041
*/
4142
private $shippingFactory;
4243

44+
/**
45+
* @inheritdoc
46+
*/
4347
protected function setUp()
4448
{
4549
$objectManager = Bootstrap::getObjectManager();
@@ -58,10 +62,8 @@ protected function setUp()
5862
* @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
5963
* @magentoDataFixture Magento/Customer/_files/customer_with_addresses.php
6064
* @dataProvider getAddressesVariation
61-
* @expectedException \Magento\Framework\Exception\InputException
62-
* @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again.
6365
*/
64-
public function testDifferentAddresses(bool $swapShipping)
66+
public function testDifferentAddresses(bool $swapShipping): void
6567
{
6668
$cart = $this->cartRepo->getForCustomer(1);
6769
$otherCustomer = $this->customerRepo->get('customer_with_addresses@test.com');
@@ -86,6 +88,14 @@ public function testDifferentAddresses(bool $swapShipping)
8688
$shippingInformation->setBillingAddress($billingAddress);
8789
$shippingInformation->setShippingAddress($shippingAddress);
8890
$shippingInformation->setShippingMethodCode('flatrate');
91+
92+
$this->expectExceptionMessage(
93+
sprintf(
94+
'The shipping information was unable to be saved. Error: "Invalid customer address id %s"',
95+
$address->getCustomerAddressId()
96+
)
97+
);
98+
$this->expectException(InputException::class);
8999
$this->management->saveAddressInformation($cart->getId(), $shippingInformation);
90100
}
91101

0 commit comments

Comments
 (0)