本文整理汇总了PHP中Magento\Customer\Model\Customer::setEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::setEmail方法的具体用法?PHP Customer::setEmail怎么用?PHP Customer::setEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Model\Customer
的用法示例。
在下文中一共展示了Customer::setEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSendPasswordResetConfirmationEmail
/**
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testSendPasswordResetConfirmationEmail()
{
$storeId = 1;
$storeIds = array(1);
$email = 'test@example.com';
$firstName = 'Foo';
$lastName = 'Bar';
$this->_model->setStoreId(0);
$this->_model->setWebsiteId(1);
$this->_model->setEmail($email);
$this->_model->setFirstname($firstName);
$this->_model->setLastname($lastName);
$this->_config->expects($this->any())->method('getAttribute')->will($this->returnValue($this->_attribute));
$this->_attribute->expects($this->any())->method('isVisible')->will($this->returnValue(false));
$this->_storeManager->expects($this->once())->method('getWebsite')->with($this->equalTo(1))->will($this->returnValue($this->_website));
$this->_storeManager->expects($this->once())->method('getStore')->with(0)->will($this->returnValue($this->_storetMock));
$this->_website->expects($this->once())->method('getStoreIds')->will($this->returnValue($storeIds));
$this->_scopeConfigMock->expects($this->at(0))->method('getValue')->with(\Magento\Customer\Model\Customer::XML_PATH_RESET_PASSWORD_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)->will($this->returnValue('templateId'));
$this->_scopeConfigMock->expects($this->at(1))->method('getValue')->with(\Magento\Customer\Model\Customer::XML_PATH_FORGOT_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)->will($this->returnValue('sender'));
$this->_transportBuilderMock->expects($this->once())->method('setTemplateOptions')->will($this->returnSelf());
$this->_transportBuilderMock->expects($this->once())->method('setTemplateVars')->with(array('customer' => $this->_model, 'store' => $this->_storetMock))->will($this->returnSelf());
$this->_transportBuilderMock->expects($this->once())->method('addTo')->with($this->equalTo($email), $this->equalTo($firstName . ' ' . $lastName))->will($this->returnSelf());
$this->_transportBuilderMock->expects($this->once())->method('setFrom')->with('sender')->will($this->returnSelf());
$this->_transportBuilderMock->expects($this->once())->method('setTemplateIdentifier')->with('templateId')->will($this->returnSelf());
$this->_transportBuilderMock->expects($this->once())->method('getTransport')->will($this->returnValue($this->_transportMock));
$this->_transportMock->expects($this->once())->method('sendMessage');
$this->_model->sendPasswordResetNotificationEmail();
}