Skip to content

Commit 44a601b

Browse files
committed
AC-15104::[CE] PHPUnit 12: Upgrade Checkout & Cart Management related test cases
1 parent d994e96 commit 44a601b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use PHPUnit\Framework\TestCase;
3030
use Psr\Log\LoggerInterface;
3131
use Magento\Quote\Test\Unit\Helper\QuoteIdMaskTestHelper;
32+
use Magento\Quote\Model\QuoteAddressValidationService;
3233

3334
/**
3435
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -107,6 +108,8 @@ protected function setUp(): void
107108
$this->saveLimiterMock = $this->createMock(PaymentSavingRateLimiterInterface::class);
108109
$this->paymentInformationManagementMock = $this->createMock(PaymentInformationManagementInterface::class);
109110
$this->addressComparatorMock = $this->createMock(AddressComparatorInterface::class);
111+
$quoteAddressValidationServiceMock = $this->createMock(QuoteAddressValidationService::class);
112+
110113
$this->model = new GuestPaymentInformationManagement(
111114
$this->billingAddressManagementMock,
112115
$this->paymentMethodManagementMock,
@@ -117,7 +120,8 @@ protected function setUp(): void
117120
$this->loggerMock,
118121
$this->limiterMock,
119122
$this->saveLimiterMock,
120-
$this->addressComparatorMock
123+
$this->addressComparatorMock,
124+
$quoteAddressValidationServiceMock
121125
);
122126
}
123127

app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use PHPUnit\Framework\MockObject\MockObject;
3232
use PHPUnit\Framework\TestCase;
3333
use Psr\Log\LoggerInterface;
34+
use Magento\Quote\Model\QuoteAddressValidationService;
3435

3536
/**
3637
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -105,6 +106,8 @@ protected function setUp(): void
105106
$paymentDetailsFactoryMock = $this->createMock(PaymentDetailsFactory::class);
106107
$cartTotalsRepositoryMock = $this->createMock(CartTotalRepositoryInterface::class);
107108
$addressComparatorMock = $this->createMock(AddressComparatorInterface::class);
109+
$quoteAddressValidationServiceMock = $this->createMock(QuoteAddressValidationService::class);
110+
108111
$this->model = new PaymentInformationManagement(
109112
$this->billingAddressManagementMock,
110113
$this->paymentMethodManagementMock,
@@ -116,7 +119,8 @@ protected function setUp(): void
116119
$this->cartRepositoryMock,
117120
$this->addressRepositoryMock,
118121
$addressComparatorMock,
119-
$this->loggerMock
122+
$this->loggerMock,
123+
$quoteAddressValidationServiceMock
120124
);
121125

122126
$this->quoteShippingAddress = $this->createMock(Address::class);

app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
use PHPUnit\Framework\MockObject\MockObject;
4040
use PHPUnit\Framework\TestCase;
4141
use Magento\Quote\Test\Unit\Helper\CartExtensionTestHelper;
42+
use Magento\Quote\Model\QuoteAddressValidationService;
4243

4344
/**
4445
* Test for \Magento\Checkout\Model\ShippingInformationManagement.
@@ -171,6 +172,8 @@ protected function setUp(): void
171172
$this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
172173
$this->totalsCollectorMock = $this->createMock(TotalsCollector::class);
173174
$this->addressComparatorMock = $this->createMock(AddressComparatorInterface::class);
175+
$quoteAddressValidationServiceMock = $this->createMock(QuoteAddressValidationService::class);
176+
174177
$this->model = new ShippingInformationManagement(
175178
$this->paymentMethodManagementMock,
176179
$this->paymentDetailsFactoryMock,
@@ -184,7 +187,8 @@ protected function setUp(): void
184187
$this->cartExtensionFactoryMock,
185188
$this->shippingAssignmentFactoryMock,
186189
$this->shippingFactoryMock,
187-
$this->addressComparatorMock
190+
$this->addressComparatorMock,
191+
$quoteAddressValidationServiceMock
188192
);
189193
}
190194

@@ -331,10 +335,6 @@ public function testSaveAddressInformationWithLocalizedException(): void
331335
$this->quoteMock->expects($this->once())
332336
->method('getItemsCount')
333337
->willReturn(self::STUB_ITEMS_COUNT);
334-
$this->quoteMock->expects($this->once())
335-
->method('setIsMultiShipping')
336-
->with(false)
337-
->willReturnSelf();
338338
$this->quoteMock->expects($this->once())
339339
->method('setBillingAddress')
340340
->with($billingAddress)
@@ -401,9 +401,6 @@ public function testSaveAddressInformationIfCanNotSaveQuote(): void
401401
$this->quoteMock->expects($this->once())
402402
->method('getItemsCount')
403403
->willReturn(self::STUB_ITEMS_COUNT);
404-
$this->quoteMock->expects($this->once())
405-
->method('setIsMultiShipping')
406-
->with(false)->willReturnSelf();
407404
$this->quoteMock->expects($this->once())
408405
->method('setBillingAddress')
409406
->with($billingAddress)

0 commit comments

Comments
 (0)