Skip to content

Commit e3aea78

Browse files
committed
Merge remote-tracking branch 'origin/BUG#AC-3031' into Spartans_2_4_6_Quality_Backlog
2 parents 1e852be + b5603c9 commit e3aea78

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
424424
}
425425
}
426426
$quote->setCustomerIsGuest(true);
427-
$groupId = $customer ? $customer->getGroupId() : GroupInterface::NOT_LOGGED_IN_ID;
428-
$quote->setCustomerGroupId($groupId);
427+
$quote->setCustomerGroupId(
428+
$quote->getCustomerId() ? $customer->getGroupId() : GroupInterface::NOT_LOGGED_IN_ID
429+
);
429430
}
430431

431432
$remoteAddress = $this->remoteAddress->getRemoteAddress();

app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,16 @@ protected function setUp(): void
240240
);
241241

242242
$this->quoteMock = $this->getMockBuilder(Quote::class)
243-
->addMethods(['setCustomerEmail', 'setCustomerGroupId', 'setCustomerId', 'setRemoteIp', 'setXForwardedFor'])
243+
->addMethods(
244+
[
245+
'setCustomerEmail',
246+
'setCustomerGroupId',
247+
'setCustomerId',
248+
'getCustomerId',
249+
'setRemoteIp',
250+
'setXForwardedFor',
251+
]
252+
)
244253
->onlyMethods(
245254
[
246255
'assignCustomer',
@@ -853,6 +862,7 @@ public function testPlaceOrderIfCustomerIsGuest(): void
853862
$this->quoteMock->expects($this->any())->method('getBillingAddress')->with()->willReturn($addressMock);
854863

855864
$this->quoteMock->expects($this->once())->method('setCustomerIsGuest')->with(true)->willReturnSelf();
865+
$this->quoteMock->expects($this->once())->method('getCustomerId')->willReturn(null);
856866
$this->quoteMock->expects($this->once())
857867
->method('setCustomerGroupId')
858868
->with(GroupInterface::NOT_LOGGED_IN_ID);

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function testSubmitGuestCustomer(): void
132132
$quote = $this->getQuoteByReservedOrderId->execute('guest_quote');
133133
$this->cartManagement->placeOrder($quote->getId());
134134
$quoteAfterOrderPlaced = $this->getQuoteByReservedOrderId->execute('guest_quote');
135-
self::assertEquals(2, $quoteAfterOrderPlaced->getCustomerGroupId());
135+
self::assertEquals(0, $quoteAfterOrderPlaced->getCustomerGroupId());
136136
self::assertEquals(3, $quoteAfterOrderPlaced->getCustomerTaxClassId());
137137
}
138138

0 commit comments

Comments
 (0)