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()); }
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()); }
/** * Verify if username is set in session */ public function testGetUserName() { $this->assertEquals('John Smith', $this->contactsHelper->getUserName()); }
/** * Verify if username is set in session */ public function testGetUserName() { $this->assertEquals('Firstname Lastname', $this->contactsHelper->getUserName()); }