/** * @param string|null $skipConfirmationIfEmail * @param int $isConfirmationRequired * @param string|null $confirmation * @param string $expected * @dataProvider dataProviderGetConfirmationStatus */ public function testGetConfirmationStatus($skipConfirmationIfEmail, $isConfirmationRequired, $confirmation, $expected) { $websiteId = 1; $customerId = 1; $customerEmail = '*****@*****.**'; $customerMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock(); $customerMock->expects($this->once())->method('getId')->willReturn($customerId); $customerMock->expects($this->any())->method('getConfirmation')->willReturn($confirmation); $customerMock->expects($this->any())->method('getEmail')->willReturn($customerEmail); $customerMock->expects($this->any())->method('getWebsiteId')->willReturn($websiteId); $this->registry->expects($this->once())->method('registry')->with('skip_confirmation_if_email')->willReturn($skipConfirmationIfEmail); $this->scopeConfig->expects($this->any())->method('getValue')->with(AccountManagement::XML_PATH_IS_CONFIRM, ScopeInterface::SCOPE_WEBSITES, $websiteId)->willReturn($isConfirmationRequired); $this->customerRepository->expects($this->once())->method('getById')->with($customerId)->willReturn($customerMock); $this->assertEquals($expected, $this->accountManagement->getConfirmationStatus($customerId)); }
/** * Involve new customer to system * * @return $this */ protected function _involveNewCustomer() { $customer = $this->_quote->getCustomer(); $confirmationStatus = $this->_accountManagement->getConfirmationStatus($customer->getId()); if ($confirmationStatus === AccountManagement::ACCOUNT_CONFIRMATION_REQUIRED) { $this->_messageManager->addSuccess(__('Thank you for registering with Main Website Store.')); } else { $this->getCustomerSession()->regenerateId(); $this->getCustomerSession()->loginById($customer->getId()); } return $this; }
/** * {@inheritdoc} */ public function getConfirmationStatus($customerId) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getConfirmationStatus'); if (!$pluginInfo) { return parent::getConfirmationStatus($customerId); } else { return $this->___callPlugins('getConfirmationStatus', func_get_args(), $pluginInfo); } }
/** * Involve new customer to system * * @return $this */ protected function _involveNewCustomer() { $customer = $this->_quote->getCustomer(); $confirmationStatus = $this->_accountManagement->getConfirmationStatus($customer->getId()); if ($confirmationStatus === AccountManagement::ACCOUNT_CONFIRMATION_REQUIRED) { $url = $this->_customerUrl->getEmailConfirmationUrl($customer->getEmail()); $this->_messageManager->addSuccess(__('Account confirmation is required. Please check your email for confirmation link. To resend confirmation email please <a href="%1">click here</a>.', $url)); } else { $this->getCustomerSession()->regenerateId(); $this->getCustomerSession()->loginById($customer->getId()); } return $this; }