Skip to content

Commit b4128b2

Browse files
committed
Merge pull request #597 from magento-south/BUGS
[South] Bug fixes & tests
2 parents b2cbffb + b981286 commit b4128b2

33 files changed

+1096
-405
lines changed

app/code/Magento/Customer/Controller/Account.php

Lines changed: 0 additions & 110 deletions
This file was deleted.

app/code/Magento/Customer/Controller/Account/Confirm.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
*/
77
namespace Magento\Customer\Controller\Account;
88

9+
use Magento\Customer\Controller\AccountInterface;
910
use Magento\Customer\Model\Url;
11+
use Magento\Framework\App\Action\Action;
1012
use Magento\Framework\App\Action\Context;
1113
use Magento\Customer\Model\Session;
1214
use Magento\Framework\App\Config\ScopeConfigInterface;
13-
use Magento\Framework\View\Result\PageFactory;
1415
use Magento\Store\Model\StoreManagerInterface;
1516
use Magento\Customer\Api\AccountManagementInterface;
1617
use Magento\Customer\Api\CustomerRepositoryInterface;
@@ -25,7 +26,7 @@
2526
*
2627
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2728
*/
28-
class Confirm extends \Magento\Customer\Controller\Account
29+
class Confirm extends Action implements AccountInterface
2930
{
3031
/** @var ScopeConfigInterface */
3132
protected $scopeConfig;
@@ -45,37 +46,39 @@ class Confirm extends \Magento\Customer\Controller\Account
4546
/** @var \Magento\Framework\UrlInterface */
4647
protected $urlModel;
4748

49+
/**
50+
* @var Session
51+
*/
52+
protected $session;
53+
4854
/**
4955
* @param Context $context
5056
* @param Session $customerSession
51-
* @param PageFactory $resultPageFactory
5257
* @param ScopeConfigInterface $scopeConfig
5358
* @param StoreManagerInterface $storeManager
5459
* @param AccountManagementInterface $customerAccountManagement
5560
* @param CustomerRepositoryInterface $customerRepository
5661
* @param Address $addressHelper
5762
* @param UrlFactory $urlFactory
58-
*
59-
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6063
*/
6164
public function __construct(
6265
Context $context,
6366
Session $customerSession,
64-
PageFactory $resultPageFactory,
6567
ScopeConfigInterface $scopeConfig,
6668
StoreManagerInterface $storeManager,
6769
AccountManagementInterface $customerAccountManagement,
6870
CustomerRepositoryInterface $customerRepository,
6971
Address $addressHelper,
7072
UrlFactory $urlFactory
7173
) {
74+
$this->session = $customerSession;
7275
$this->scopeConfig = $scopeConfig;
7376
$this->storeManager = $storeManager;
7477
$this->customerAccountManagement = $customerAccountManagement;
7578
$this->customerRepository = $customerRepository;
7679
$this->addressHelper = $addressHelper;
7780
$this->urlModel = $urlFactory->create();
78-
parent::__construct($context, $customerSession, $resultPageFactory);
81+
parent::__construct($context);
7982
}
8083

8184
/**
@@ -88,7 +91,7 @@ public function execute()
8891
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
8992
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
9093

91-
if ($this->_getSession()->isLoggedIn()) {
94+
if ($this->session->isLoggedIn()) {
9295
$resultRedirect->setPath('*/*/');
9396
return $resultRedirect;
9497
}
@@ -102,7 +105,7 @@ public function execute()
102105
// log in and send greeting email
103106
$customerEmail = $this->customerRepository->getById($customerId)->getEmail();
104107
$customer = $this->customerAccountManagement->activate($customerEmail, $key);
105-
$this->_getSession()->setCustomerDataAsLoggedIn($customer);
108+
$this->session->setCustomerDataAsLoggedIn($customer);
106109

107110
$this->messageManager->addSuccess($this->getSuccessMessage());
108111
$resultRedirect->setUrl($this->getSuccessRedirect());
@@ -158,8 +161,8 @@ protected function getSuccessRedirect()
158161
Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD,
159162
ScopeInterface::SCOPE_STORE
160163
);
161-
if (!$redirectToDashboard && $this->_getSession()->getBeforeAuthUrl()) {
162-
$successUrl = $this->_getSession()->getBeforeAuthUrl(true);
164+
if (!$redirectToDashboard && $this->session->getBeforeAuthUrl()) {
165+
$successUrl = $this->session->getBeforeAuthUrl(true);
163166
} else {
164167
$successUrl = $this->urlModel->getUrl('*/*/index', ['_secure' => true]);
165168
}

app/code/Magento/Customer/Controller/Account/Confirmation.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,33 @@
66
*/
77
namespace Magento\Customer\Controller\Account;
88

9+
use Magento\Customer\Controller\AccountInterface;
10+
use Magento\Framework\App\Action\Action;
911
use Magento\Framework\App\Action\Context;
1012
use Magento\Customer\Model\Session;
1113
use Magento\Framework\View\Result\PageFactory;
1214
use Magento\Store\Model\StoreManagerInterface;
1315
use Magento\Customer\Api\AccountManagementInterface;
1416
use Magento\Framework\Exception\State\InvalidTransitionException;
1517

16-
class Confirmation extends \Magento\Customer\Controller\Account
18+
class Confirmation extends Action implements AccountInterface
1719
{
1820
/** @var StoreManagerInterface */
1921
protected $storeManager;
2022

2123
/** @var AccountManagementInterface */
2224
protected $customerAccountManagement;
2325

26+
/**
27+
* @var Session
28+
*/
29+
protected $session;
30+
31+
/**
32+
* @var PageFactory
33+
*/
34+
protected $resultPageFactory;
35+
2436
/**
2537
* @param Context $context
2638
* @param Session $customerSession
@@ -35,9 +47,11 @@ public function __construct(
3547
StoreManagerInterface $storeManager,
3648
AccountManagementInterface $customerAccountManagement
3749
) {
50+
$this->session = $customerSession;
51+
$this->resultPageFactory = $resultPageFactory;
3852
$this->storeManager = $storeManager;
3953
$this->customerAccountManagement = $customerAccountManagement;
40-
parent::__construct($context, $customerSession, $resultPageFactory);
54+
parent::__construct($context);
4155
}
4256

4357
/**
@@ -47,7 +61,7 @@ public function __construct(
4761
*/
4862
public function execute()
4963
{
50-
if ($this->_getSession()->isLoggedIn()) {
64+
if ($this->session->isLoggedIn()) {
5165
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
5266
$resultRedirect = $this->resultRedirectFactory->create();
5367
$resultRedirect->setPath('*/*/');
@@ -73,7 +87,7 @@ public function execute()
7387
$resultRedirect->setPath('*/*/*', ['email' => $email, '_secure' => true]);
7488
return $resultRedirect;
7589
}
76-
$this->_getSession()->setUsername($email);
90+
$this->session->setUsername($email);
7791
$resultRedirect->setPath('*/*/index', ['_secure' => true]);
7892
return $resultRedirect;
7993
}

app/code/Magento/Customer/Controller/Account/Create.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,28 @@
66
*/
77
namespace Magento\Customer\Controller\Account;
88

9+
use Magento\Customer\Controller\AccountInterface;
910
use Magento\Customer\Model\Registration;
1011
use Magento\Customer\Model\Session;
12+
use Magento\Framework\App\Action\Action;
1113
use Magento\Framework\View\Result\PageFactory;
1214
use Magento\Framework\App\Action\Context;
1315

14-
class Create extends \Magento\Customer\Controller\Account
16+
class Create extends Action implements AccountInterface
1517
{
1618
/** @var Registration */
1719
protected $registration;
1820

21+
/**
22+
* @var Session
23+
*/
24+
protected $session;
25+
26+
/**
27+
* @var PageFactory
28+
*/
29+
protected $resultPageFactory;
30+
1931
/**
2032
* @param Context $context
2133
* @param Session $customerSession
@@ -28,8 +40,10 @@ public function __construct(
2840
PageFactory $resultPageFactory,
2941
Registration $registration
3042
) {
43+
$this->session = $customerSession;
44+
$this->resultPageFactory = $resultPageFactory;
3145
$this->registration = $registration;
32-
parent::__construct($context, $customerSession, $resultPageFactory);
46+
parent::__construct($context);
3347
}
3448

3549
/**
@@ -39,7 +53,7 @@ public function __construct(
3953
*/
4054
public function execute()
4155
{
42-
if ($this->_getSession()->isLoggedIn() || !$this->registration->isAllowed()) {
56+
if ($this->session->isLoggedIn() || !$this->registration->isAllowed()) {
4357
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
4458
$resultRedirect = $this->resultRedirectFactory->create();
4559
$resultRedirect->setPath('*/*');

app/code/Magento/Customer/Controller/Account/CreatePassword.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,27 @@
77
namespace Magento\Customer\Controller\Account;
88

99
use Magento\Customer\Api\AccountManagementInterface;
10+
use Magento\Customer\Controller\AccountInterface;
1011
use Magento\Customer\Model\Session;
12+
use Magento\Framework\App\Action\Action;
1113
use Magento\Framework\View\Result\PageFactory;
1214
use Magento\Framework\App\Action\Context;
1315

14-
class CreatePassword extends \Magento\Customer\Controller\Account
16+
class CreatePassword extends Action implements AccountInterface
1517
{
1618
/** @var AccountManagementInterface */
1719
protected $accountManagement;
1820

21+
/**
22+
* @var Session
23+
*/
24+
protected $session;
25+
26+
/**
27+
* @var PageFactory
28+
*/
29+
protected $resultPageFactory;
30+
1931
/**
2032
* @param Context $context
2133
* @param Session $customerSession
@@ -28,8 +40,10 @@ public function __construct(
2840
PageFactory $resultPageFactory,
2941
AccountManagementInterface $accountManagement
3042
) {
43+
$this->session = $customerSession;
44+
$this->resultPageFactory = $resultPageFactory;
3145
$this->accountManagement = $accountManagement;
32-
parent::__construct($context, $customerSession, $resultPageFactory);
46+
parent::__construct($context);
3347
}
3448

3549
/**

0 commit comments

Comments
 (0)