Skip to content

Commit 9746716

Browse files
committed
Backport-issue-195196
1 parent 0d99fa8 commit 9746716

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/>
7070
<click selector="{{OrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
7171
<see selector="{{OrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeAdminOrderStatus"/>
72-
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="Guest" stepKey="seeAdminOrderGuest"/>
72+
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.fullname}}" stepKey="seeAdminOrderGuest"/>
7373
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAdminOrderEmail"/>
7474
<see selector="{{OrderDetailsInformationSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderBillingAddress"/>
7575
<see selector="{{OrderDetailsInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderShippingAddress"/>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<data key="firstname">John</data>
2222
<data key="lastname">Doe</data>
2323
<data key="middlename">S</data>
24+
<data key="fullname">John Doe</data>s
2425
<data key="password">pwdTest123!</data>
2526
<data key="prefix">Mr</data>
2627
<data key="suffix">Sr</data>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* Class QuoteManagement
2727
*
28+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2829
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2930
* @SuppressWarnings(PHPMD.TooManyFields)
3031
*/
@@ -355,6 +356,13 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
355356
if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
356357
$quote->setCustomerId(null);
357358
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
359+
if ($quote->getCustomerFirstname() === null && $quote->getCustomerLastname() === null) {
360+
$quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname());
361+
$quote->setCustomerLastname($quote->getBillingAddress()->getLastname());
362+
if ($quote->getBillingAddress()->getMiddlename() === null) {
363+
$quote->setCustomerMiddlename($quote->getBillingAddress()->getMiddlename());
364+
}
365+
}
358366
$quote->setCustomerIsGuest(true);
359367
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
360368
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ public function testPlaceOrderIfCustomerIsGuest()
642642

643643
$addressMock = $this->createPartialMock(\Magento\Quote\Model\Quote\Address::class, ['getEmail']);
644644
$addressMock->expects($this->once())->method('getEmail')->willReturn($email);
645-
$this->quoteMock->expects($this->once())->method('getBillingAddress')->with()->willReturn($addressMock);
645+
$this->quoteMock->expects($this->any())->method('getBillingAddress')->with()->willReturn($addressMock);
646646

647647
$this->quoteMock->expects($this->once())->method('setCustomerIsGuest')->with(true)->willReturnSelf();
648648
$this->quoteMock->expects($this->once())

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ public function testUpdateCustomerData()
131131
$this->assertContains($item, $actual);
132132
}
133133
$this->assertEquals('[email protected]', $quote->getCustomerEmail());
134+
$this->assertEquals('Joe', $quote->getCustomerFirstname());
135+
$this->assertEquals('Dou', $quote->getCustomerLastname());
136+
$this->assertEquals('Ivan', $quote->getCustomerMiddlename());
134137
}
135138

136139
/**

0 commit comments

Comments
 (0)