예제 #1
0
 public function testGetUserEmail()
 {
     $this->_customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true));
     $customerDataObject = $this->getMock('\\Magento\\Customer\\Api\\Data\\CustomerInterface', [], [], '', false);
     $customerDataObject->expects($this->once())->method('getEmail')->will($this->returnValue('*****@*****.**'));
     $this->_customerSession->expects($this->once())->method('getCustomerDataObject')->will($this->returnValue($customerDataObject));
     $this->assertEquals('*****@*****.**', $this->_helper->getUserEmail());
 }
예제 #2
0
 public function testGetPostValue()
 {
     $postData = ['name' => 'Some Name', 'email' => 'Some Email'];
     $dataPersistorMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\DataPersistorInterface')->getMockForAbstractClass();
     $dataPersistorMock->expects($this->once())->method('get')->with('contact_us')->willReturn($postData);
     $dataPersistorMock->expects($this->once())->method('clear')->with('contact_us');
     $this->objectManagerHelper->setBackwardCompatibleProperty($this->helper, 'dataPersistor', $dataPersistorMock);
     $this->assertSame($postData['name'], $this->helper->getPostValue('name'));
     $this->assertSame($postData['email'], $this->helper->getPostValue('email'));
 }
예제 #3
0
 /**
  * Verify if user email is set in session
  */
 public function testGetEmail()
 {
     $this->assertEquals('*****@*****.**', $this->contactsHelper->getUserEmail());
 }