当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::setFirstname方法代码示例

本文整理汇总了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();
 }
开发者ID:,项目名称:,代码行数:32,代码来源:


注:本文中的Magento\Customer\Model\Customer::setFirstname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。