本文整理匯總了PHP中Magento\Customer\Model\Customer::setFirstname方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customer::setFirstname方法的具體用法?PHP Customer::setFirstname怎麽用?PHP Customer::setFirstname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Customer\Model\Customer
的用法示例。
在下文中一共展示了Customer::setFirstname方法的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();
}