Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-5021 fixed guest checkout with custom shipping carrier with unde… #19505

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ private function limitShippingCarrier(Quote $quote) : void
{
$shippingAddress = $quote->getShippingAddress();
if ($shippingAddress && $shippingAddress->getShippingMethod()) {
$shippingDataArray = explode('_', $shippingAddress->getShippingMethod());
$shippingCarrier = array_shift($shippingDataArray);
$shippingAddress->setLimitCarrier($shippingCarrier);
$shippingRate = $shippingAddress->getShippingRateByCode($shippingAddress->getShippingMethod());
$shippingAddress->setLimitCarrier($shippingRate->getCarrier());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function testSavePaymentInformationAndPlaceOrderWithLocalizedException()
*/
private function getMockForAssignBillingAddress(
int $cartId,
\PHPUnit_Framework_MockObject_MockObject $billingAddressMock
\PHPUnit_Framework_MockObject_MockObject $billingAddressMock
) : void {
$quoteIdMask = $this->createPartialMock(QuoteIdMask::class, ['getQuoteId', 'load']);
$this->quoteIdMaskFactoryMock->method('create')
Expand All @@ -287,9 +287,11 @@ private function getMockForAssignBillingAddress(
$billingAddressId = 1;
$quote = $this->createMock(Quote::class);
$quoteBillingAddress = $this->createMock(Address::class);
$shippingRate = $this->createPartialMock(\Magento\Quote\Model\Quote\Address\Rate::class, []);
$shippingRate->setCarrier('flatrate');
$quoteShippingAddress = $this->createPartialMock(
Address::class,
['setLimitCarrier', 'getShippingMethod']
['setLimitCarrier', 'getShippingMethod', 'getShippingRateByCode']
);
$this->cartRepositoryMock->method('getActive')
->with($cartId)
Expand All @@ -309,6 +311,9 @@ private function getMockForAssignBillingAddress(
$quote->expects($this->once())
->method('setBillingAddress')
->with($billingAddressMock);
$quoteShippingAddress->expects($this->any())
->method('getShippingRateByCode')
->willReturn($shippingRate);
$quote->expects($this->once())
->method('setDataChanges')
->willReturnSelf();
Expand Down