forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request magento#3575 from magento-tsg/2.2-develop-pr66
[TSG] Backporting for 2.2 (pr66) (2.2.8)
- Loading branch information
Showing
38 changed files
with
687 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="CustomerLogoutStorefrontByMenuItemsActionGroup"> | ||
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}" | ||
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}" | ||
visible="false" | ||
stepKey="clickHeaderCustomerMenuButton" /> | ||
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" /> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Persistent\CustomerData; | ||
|
||
use Magento\Customer\Api\CustomerRepositoryInterface; | ||
use Magento\Customer\CustomerData\SectionSourceInterface; | ||
use Magento\Customer\Helper\View; | ||
use Magento\Persistent\Helper\Session; | ||
|
||
/** | ||
* Customer persistent section | ||
*/ | ||
class Persistent implements SectionSourceInterface | ||
{ | ||
/** | ||
* @var Session | ||
*/ | ||
private $persistentSession; | ||
|
||
/** | ||
* @var View | ||
*/ | ||
private $customerViewHelper; | ||
|
||
/** | ||
* @var CustomerRepositoryInterface | ||
*/ | ||
private $customerRepository; | ||
|
||
/** | ||
* @param Session $persistentSession | ||
* @param View $customerViewHelper | ||
* @param CustomerRepositoryInterface $customerRepository | ||
*/ | ||
public function __construct( | ||
Session $persistentSession, | ||
View $customerViewHelper, | ||
CustomerRepositoryInterface $customerRepository | ||
) { | ||
$this->persistentSession = $persistentSession; | ||
$this->customerViewHelper = $customerViewHelper; | ||
$this->customerRepository = $customerRepository; | ||
} | ||
|
||
/** | ||
* Get data | ||
* | ||
* @return array | ||
*/ | ||
public function getSectionData() | ||
{ | ||
if (!$this->persistentSession->isPersistent()) { | ||
return []; | ||
} | ||
|
||
$customerId = $this->persistentSession->getSession()->getCustomerId(); | ||
if (!$customerId) { | ||
return []; | ||
} | ||
|
||
$customer = $this->customerRepository->getById($customerId); | ||
|
||
return [ | ||
'fullname' => $this->customerViewHelper->getCustomerName($customer), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/code/Magento/Persistent/Model/Plugin/PersistentCustomerContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Persistent\Model\Plugin; | ||
|
||
/** | ||
* Plugin for Magento\Framework\App\Http\Context to create new page cache variation for persistent session. | ||
*/ | ||
class PersistentCustomerContext | ||
{ | ||
/** | ||
* Persistent session | ||
* | ||
* @var \Magento\Persistent\Helper\Session | ||
*/ | ||
private $persistentSession; | ||
|
||
/** | ||
* @param \Magento\Persistent\Helper\Session $persistentSession | ||
*/ | ||
public function __construct( | ||
\Magento\Persistent\Helper\Session $persistentSession | ||
) { | ||
$this->persistentSession = $persistentSession; | ||
} | ||
|
||
/** | ||
* @param \Magento\Framework\App\Http\Context $subject | ||
* @return mixed | ||
*/ | ||
public function beforeGetVaryString(\Magento\Framework\App\Http\Context $subject) | ||
{ | ||
if ($this->persistentSession->isPersistent()) { | ||
$subject->setValue('PERSISTENT', 1, 0); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/code/Magento/Persistent/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="CustomerLoginOnStorefrontWithRememberMeChecked" extends="CustomerLoginOnStorefront"> | ||
<checkOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" | ||
before="clickSignInAccountButton" | ||
stepKey="checkRememberMe"/> | ||
</actionGroup> | ||
|
||
<actionGroup name="CustomerLoginOnStorefrontWithRememberMeUnChecked" extends="CustomerLoginOnStorefront"> | ||
<uncheckOption selector="{{StorefrontCustomerSignInFormSection.rememberMe}}" | ||
before="clickSignInAccountButton" | ||
stepKey="unCheckRememberMe"/> | ||
</actionGroup> | ||
</actionGroups> |
14 changes: 14 additions & 0 deletions
14
app/code/Magento/Persistent/Test/Mftf/Section/StorefrontCustomerSignInFormSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="StorefrontCustomerSignInFormSection"> | ||
<element name="rememberMe" type="checkbox" selector="[name='persistent_remember_me']"/> | ||
</section> | ||
</sections> |
Oops, something went wrong.