/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Framework\UrlFactory $urlFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\State $appState * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Core\Helper\Data $coreHelperData * @param \Magento\Customer\Helper\Data $customerHelperData * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\Address $addressHelper, \Magento\Framework\UrlFactory $urlFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\State $appState, CustomerAccountServiceInterface $customerAccountService, \Magento\Core\Helper\Data $coreHelperData, \Magento\Customer\Helper\Data $customerHelperData, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator) { $this->coreHelperData = $coreHelperData; $this->_customerHelperData = $customerHelperData; $this->_formKeyValidator = $formKeyValidator; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $appState, $customerAccountService); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param AccountManagementInterface $customerAccountManagement * @param CustomerUrl $customerHelperData * @param Validator $formKeyValidator * @param AccountRedirect $accountRedirect * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, AccountManagementInterface $customerAccountManagement, CustomerUrl $customerHelperData, Validator $formKeyValidator, AccountRedirect $accountRedirect) { $this->customerAccountManagement = $customerAccountManagement; $this->customerUrl = $customerHelperData; $this->formKeyValidator = $formKeyValidator; $this->accountRedirect = $accountRedirect; parent::__construct($context, $customerSession, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param AccountManagementInterface $customerAccountManagement * @param CustomerRepositoryInterface $customerRepository * @param Validator $formKeyValidator * @param CustomerExtractor $customerExtractor * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, AccountManagementInterface $customerAccountManagement, CustomerRepositoryInterface $customerRepository, Validator $formKeyValidator, CustomerExtractor $customerExtractor) { $this->customerAccountManagement = $customerAccountManagement; $this->customerRepository = $customerRepository; $this->formKeyValidator = $formKeyValidator; $this->customerExtractor = $customerExtractor; parent::__construct($context, $customerSession, $resultPageFactory); }
/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Framework\UrlFactory $urlFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder * @param \Magento\Customer\Model\CustomerExtractor $customerExtractor * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\Address $addressHelper, \Magento\Framework\UrlFactory $urlFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, \Magento\Customer\Model\CustomerExtractor $customerExtractor) { $this->_customerDetailsBuilder = $customerDetailsBuilder; $this->_formKeyValidator = $formKeyValidator; $this->_customerBuilder = $customerBuilder; $this->customerExtractor = $customerExtractor; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $customerAccountService); }
public function testLoginPostActionWhenRefererSetBeforeAuthUrl() { $this->_formKeyValidator->expects($this->once())->method('validate')->will($this->returnValue(true)); $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap(array(array('Magento\\Customer\\Helper\\Data', new \Magento\Framework\Object(array('account_url' => 1))), array('Magento\\Framework\\App\\Config\\ScopeConfigInterface', new \Magento\Framework\Object(array('config_flag' => 1))), array('Magento\\Core\\Helper\\Data', $this->getMock('Magento\\Core\\Helper\\Data', array(), array(), '', false))))); $this->customerSession->expects($this->at(0))->method('isLoggedIn')->with()->will($this->returnValue(0)); $this->customerSession->expects($this->at(4))->method('isLoggedIn')->with()->will($this->returnValue(1)); $this->request->expects($this->once())->method('getParam')->with(\Magento\Customer\Helper\Data::REFERER_QUERY_PARAM_NAME)->will($this->returnValue('referer')); $this->url->expects($this->once())->method('isOwnOriginUrl')->with(); $this->object->execute(); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param ScopeConfigInterface $scopeConfig * @param StoreManagerInterface $storeManager * @param AccountManagementInterface $customerAccountManagement * @param CustomerRepositoryInterface $customerRepository * @param Address $addressHelper * @param UrlFactory $urlFactory * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, AccountManagementInterface $customerAccountManagement, CustomerRepositoryInterface $customerRepository, Address $addressHelper, UrlFactory $urlFactory) { $this->scopeConfig = $scopeConfig; $this->storeManager = $storeManager; $this->customerAccountManagement = $customerAccountManagement; $this->customerRepository = $customerRepository; $this->addressHelper = $addressHelper; $this->urlModel = $urlFactory->create(); parent::__construct($context, $customerSession, $resultPageFactory); }
/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Framework\UrlFactory $urlFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Model\Metadata\FormFactory $formFactory * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param \Magento\Customer\Service\V1\Data\RegionBuilder $regionBuilder * @param \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder * @param \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder * @param \Magento\Customer\Helper\Data $customerHelperData * @param \Magento\Framework\Escaper $escaper * @param \Magento\Customer\Model\CustomerExtractor $customerExtractor * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\Address $addressHelper, \Magento\Framework\UrlFactory $urlFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Model\Metadata\FormFactory $formFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, \Magento\Customer\Service\V1\Data\RegionBuilder $regionBuilder, \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder, \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder, \Magento\Customer\Helper\Data $customerHelperData, \Magento\Framework\Escaper $escaper, \Magento\Customer\Model\CustomerExtractor $customerExtractor) { $this->_formFactory = $formFactory; $this->_subscriberFactory = $subscriberFactory; $this->_regionBuilder = $regionBuilder; $this->_addressBuilder = $addressBuilder; $this->_customerDetailsBuilder = $customerDetailsBuilder; $this->_customerHelperData = $customerHelperData; $this->escaper = $escaper; $this->customerExtractor = $customerExtractor; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $customerAccountService); }
public function testLoginPostActionWhenRefererSetBeforeAuthUrl() { $this->_formKeyValidator->expects($this->once())->method('validate')->will($this->returnValue(true)); $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\App\\Config\\ScopeConfigInterface', new \Magento\Framework\Object(['config_flag' => 1])], ['Magento\\Core\\Helper\\Data', $this->getMock('Magento\\Core\\Helper\\Data', [], [], '', false)]])); $this->customerSession->expects($this->at(0))->method('isLoggedIn')->with()->will($this->returnValue(0)); $this->customerSession->expects($this->at(4))->method('isLoggedIn')->with()->will($this->returnValue(1)); $this->request->expects($this->once())->method('getParam')->with(Url::REFERER_QUERY_PARAM_NAME)->will($this->returnValue('referer')); $this->url->expects($this->once())->method('isOwnOriginUrl')->with(); $this->redirectFactoryMock->expects($this->once())->method('create')->willReturn($this->redirectResultMock); $this->redirectResultMock->expects($this->once())->method('setUrl')->willReturnSelf(); $this->object->execute(); }
public function testLoginFailure() { $jsonRequest = '{"username":"******", "password":"******"}'; $loginFailureResponse = '{"message":"Invalid login or password."}'; $this->request->expects($this->any())->method('getRawBody')->willReturn($jsonRequest); $this->request->expects($this->any())->method('getMethod')->willReturn('POST'); $this->request->expects($this->any())->method('isXmlHttpRequest')->willReturn(true); $this->resultJsonFactory->expects($this->never())->method('create')->willReturn($this->resultJson); $this->dataHelper->expects($this->any())->method('jsonDecode')->with($jsonRequest)->willReturn(['username' => '*****@*****.**', 'password' => 'invalid']); $customerMock = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\CustomerInterface'); $this->customerAccountManagementMock->expects($this->any())->method('authenticate')->with('*****@*****.**', 'invalid')->willThrowException(new InvalidEmailOrPasswordException('Invalid login or password.', [])); $this->customerSession->expects($this->never())->method('setCustomerDataAsLoggedIn')->with($customerMock); $this->customerSession->expects($this->never())->method('regenerateId'); $this->resultJson->expects($this->never())->method('setData')->with(['message' => 'Invalid login or password.'])->willReturn($loginFailureResponse); $this->resultRaw->expects($this->once())->method('setHttpResponseCode')->with(401); $this->object->execute(); }
/** * @param $customerId * @param $key * @param $backUrl * @param $successUrl * @param $resultUrl * @param $isSetFlag * @param $successMessage * * @dataProvider getSuccessRedirectDataProvider */ public function testSuccessRedirect($customerId, $key, $backUrl, $successUrl, $resultUrl, $isSetFlag, $successMessage) { $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false)); $this->requestMock->expects($this->any())->method('getParam')->willReturnMap([['id', false, $customerId], ['key', false, $key], ['back_url', false, $backUrl]]); $this->customerRepositoryMock->expects($this->any())->method('getById')->with($customerId)->will($this->returnValue($this->customerDataMock)); $email = '*****@*****.**'; $this->customerDataMock->expects($this->once())->method('getEmail')->will($this->returnValue($email)); $this->customerAccountManagementMock->expects($this->once())->method('activate')->with($this->equalTo($email), $this->equalTo($key))->will($this->returnValue($this->customerDataMock)); $this->customerSessionMock->expects($this->any())->method('setCustomerDataAsLoggedIn')->with($this->equalTo($this->customerDataMock))->willReturnSelf(); $this->messageManagerMock->expects($this->any())->method('addSuccess')->with($this->stringContains($successMessage))->willReturnSelf(); $this->storeMock->expects($this->any())->method('getFrontendName')->will($this->returnValue('frontend')); $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->storeMock)); $this->urlMock->expects($this->any())->method('getUrl')->with($this->equalTo('*/*/index'), ['_secure' => true])->will($this->returnValue($successUrl)); $this->redirectMock->expects($this->once())->method('success')->with($this->equalTo($resultUrl))->will($this->returnValue($resultUrl)); $this->scopeConfigMock->expects($this->once())->method('isSetFlag')->with($this->equalTo(Url::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD), $this->equalTo(ScopeInterface::SCOPE_STORE))->will($this->returnValue($isSetFlag)); $this->model->execute(); }
/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Helper\Address $addressHelper * @param \Magento\Framework\UrlFactory $urlFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Helper\Data $customerHelper */ public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\Address $addressHelper, \Magento\Framework\UrlFactory $urlFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Helper\Data $customerHelper) { $this->customerHelper = $customerHelper; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $customerAccountService); }
/** * @param Context $context * @param Session $customerSession * @param Address $addressHelper * @param UrlFactory $urlFactory * @param StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Framework\Escaper $escaper */ public function __construct(Context $context, Session $customerSession, Address $addressHelper, UrlFactory $urlFactory, StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, CustomerAccountServiceInterface $customerAccountService, \Magento\Framework\Escaper $escaper) { $this->escaper = $escaper; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $customerAccountService); }
/** * @param Context $context * @param Session $customerSession * @param CustomerHelper $addressHelper * @param UrlFactory $urlFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder */ public function __construct(Context $context, Session $customerSession, CustomerHelper $addressHelper, UrlFactory $urlFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder) { $this->_customerBuilder = $customerBuilder; parent::__construct($context, $customerSession, $addressHelper, $urlFactory, $storeManager, $scopeConfig, $customerAccountService); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param ForwardFactory $resultForwardFactory */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, ForwardFactory $resultForwardFactory) { $this->resultForwardFactory = $resultForwardFactory; parent::__construct($context, $customerSession, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param AccountManagementInterface $accountManagement * @param CustomerRepositoryInterface $customerRepository */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, AccountManagementInterface $accountManagement, CustomerRepositoryInterface $customerRepository) { $this->accountManagement = $accountManagement; $this->customerRepository = $customerRepository; parent::__construct($context, $customerSession, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param RedirectFactory $resultRedirectFactory * @param PageFactory $resultPageFactory * @param StoreManagerInterface $storeManager * @param AccountManagementInterface $customerAccountManagement */ public function __construct(Context $context, Session $customerSession, RedirectFactory $resultRedirectFactory, PageFactory $resultPageFactory, StoreManagerInterface $storeManager, AccountManagementInterface $customerAccountManagement) { $this->storeManager = $storeManager; $this->customerAccountManagement = $customerAccountManagement; parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param RedirectFactory $resultRedirectFactory * @param PageFactory $resultPageFactory * @param CustomerRepositoryInterface $customerRepository * @param DataObjectHelper $dataObjectHelper */ public function __construct(Context $context, Session $customerSession, RedirectFactory $resultRedirectFactory, PageFactory $resultPageFactory, CustomerRepositoryInterface $customerRepository, DataObjectHelper $dataObjectHelper) { $this->customerRepository = $customerRepository; $this->dataObjectHelper = $dataObjectHelper; parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param RedirectFactory $resultRedirectFactory * @param PageFactory $resultPageFactory * @param ScopeConfigInterface $scopeConfig * @param StoreManagerInterface $storeManager * @param AccountManagementInterface $accountManagement * @param Address $addressHelper * @param UrlFactory $urlFactory * @param FormFactory $formFactory * @param SubscriberFactory $subscriberFactory * @param RegionInterfaceFactory $regionDataFactory * @param AddressInterfaceFactory $addressDataFactory * @param CustomerInterfaceFactory $customerDataFactory * @param CustomerUrl $customerUrl * @param Registration $registration * @param Escaper $escaper * @param CustomerExtractor $customerExtractor * @param DataObjectHelper $dataObjectHelper * @param AccountRedirect $accountRedirect * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(Context $context, Session $customerSession, RedirectFactory $resultRedirectFactory, PageFactory $resultPageFactory, ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, AccountManagementInterface $accountManagement, Address $addressHelper, UrlFactory $urlFactory, FormFactory $formFactory, SubscriberFactory $subscriberFactory, RegionInterfaceFactory $regionDataFactory, AddressInterfaceFactory $addressDataFactory, CustomerInterfaceFactory $customerDataFactory, CustomerUrl $customerUrl, Registration $registration, Escaper $escaper, CustomerExtractor $customerExtractor, DataObjectHelper $dataObjectHelper, AccountRedirect $accountRedirect) { $this->scopeConfig = $scopeConfig; $this->storeManager = $storeManager; $this->accountManagement = $accountManagement; $this->addressHelper = $addressHelper; $this->formFactory = $formFactory; $this->subscriberFactory = $subscriberFactory; $this->regionDataFactory = $regionDataFactory; $this->addressDataFactory = $addressDataFactory; $this->customerDataFactory = $customerDataFactory; $this->customerUrl = $customerUrl; $this->registration = $registration; $this->escaper = $escaper; $this->customerExtractor = $customerExtractor; $this->urlModel = $urlFactory->create(); $this->dataObjectHelper = $dataObjectHelper; $this->accountRedirect = $accountRedirect; parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param RedirectFactory $resultRedirectFactory * @param PageFactory $resultPageFactory * @param AccountManagementInterface $customerAccountManagement * @param Escaper $escaper */ public function __construct(Context $context, Session $customerSession, RedirectFactory $resultRedirectFactory, PageFactory $resultPageFactory, AccountManagementInterface $customerAccountManagement, Escaper $escaper) { $this->customerAccountManagement = $customerAccountManagement; $this->escaper = $escaper; parent::__construct($context, $customerSession, $resultRedirectFactory, $resultPageFactory); }
/** * @param Context $context * @param Session $customerSession * @param PageFactory $resultPageFactory * @param Registration $registration */ public function __construct(Context $context, Session $customerSession, PageFactory $resultPageFactory, Registration $registration) { $this->registration = $registration; parent::__construct($context, $customerSession, $resultPageFactory); }