Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -73,7 +73,7 @@
<click selector="{{OrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
<waitForPageLoad stepKey="waitForOrderPageLoad"/>
<see selector="{{OrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeAdminOrderStatus"/>
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="Guest" stepKey="seeAdminOrderGuest"/>
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.fullname}}" stepKey="seeAdminOrderGuest"/>
<see selector="{{OrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAdminOrderEmail"/>
<see selector="{{OrderDetailsInformationSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderBillingAddress"/>
<see selector="{{OrderDetailsInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderShippingAddress"/>
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="middlename">S</data>
<data key="fullname">John Doe</data>
<data key="password">pwdTest123!</data>
<data key="prefix">Mr</data>
<data key="suffix">Sr</data>
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/**
* Class QuoteManagement
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
*/
Expand Down Expand Up @@ -355,6 +356,13 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
$quote->setCustomerId(null);
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
if ($quote->getCustomerFirstname() === null && $quote->getCustomerLastname() === null) {
$quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname());
$quote->setCustomerLastname($quote->getBillingAddress()->getLastname());
if ($quote->getCustomerMiddlename() === null) {
$quote->setCustomerMiddlename($quote->getBillingAddress()->getMiddlename());
}
}
$quote->setCustomerIsGuest(true);
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public function testPlaceOrderIfCustomerIsGuest()

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

$this->quoteMock->expects($this->once())->method('setCustomerIsGuest')->with(true)->willReturnSelf();
$this->quoteMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public function testUpdateCustomerData()
$this->assertContains($item, $actual);
}
$this->assertEquals('[email protected]', $quote->getCustomerEmail());
$this->assertEquals('Joe', $quote->getCustomerFirstname());
$this->assertEquals('Dou', $quote->getCustomerLastname());
$this->assertEquals('Ivan', $quote->getCustomerMiddlename());
}

/**
Expand Down