예제 #1
0
 public function testGetUserName()
 {
     $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $customerDataObject = $this->getMockBuilder('\\Magento\\Customer\\Model\\Data\\Customer')->disableOriginalConstructor()->getMock();
     $this->customerSessionMock->expects($this->once())->method('getCustomerDataObject')->willReturn($customerDataObject);
     $this->customerViewHelperMock->expects($this->once())->method('getCustomerName')->willReturn(' customer name ');
     $this->assertEquals('customer name', $this->helper->getUserName());
 }
예제 #2
0
 public function testGetUserName()
 {
     $this->_customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true));
     $objectBuilder = $this->getMockForAbstractClass('\\Magento\\Framework\\Service\\Data\\AbstractSimpleObjectBuilder', ['getData'], '', false);
     $customerDataObject = new \Magento\Customer\Service\V1\Data\Customer($objectBuilder);
     $this->_customerSession->expects($this->once())->method('getCustomerDataObject')->will($this->returnValue($customerDataObject));
     $this->_customerViewHelper->expects($this->once())->method('getCustomerName')->will($this->returnValue(' customer name '));
     $this->assertEquals('customer name', $this->_helper->getUserName());
 }
예제 #3
0
 /**
  * Verify if username is set in session
  */
 public function testGetUserName()
 {
     $this->assertEquals('John Smith', $this->contactsHelper->getUserName());
 }
예제 #4
0
파일: DataTest.php 프로젝트: aiesh/magento2
 /**
  * Verify if username is set in session
  */
 public function testGetUserName()
 {
     $this->assertEquals('Firstname Lastname', $this->contactsHelper->getUserName());
 }