Esempio n. 1
0
 /**
  * Test the Gender::getCustomer() method.
  * @return void
  */
 public function testGetCustomer()
 {
     $customerData = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\CustomerInterface')->getMockForAbstractClass();
     $this->customerSession->expects($this->once())->method('getCustomerId')->will($this->returnValue(1));
     $this->customerRepository->expects($this->once())->method('getById')->with(1)->will($this->returnValue($customerData));
     $customer = $this->block->getCustomer();
     $this->assertSame($customerData, $customer);
 }
Esempio n. 2
0
 /**
  * Test the Gender::getCustomer() method.
  * @return void
  */
 public function testGetCustomer()
 {
     $data = ['firstname' => 'John', 'lastname' => 'Doe'];
     $builder = $this->getMock('\\Magento\\Customer\\Service\\V1\\Data\\CustomerBuilder', [], [], '', false);
     $builder->expects($this->any())->method('getData')->will($this->returnValue($data));
     $customerData = new \Magento\Customer\Service\V1\Data\Customer($builder);
     $this->_customerSession->expects($this->once())->method('getCustomerId')->will($this->returnValue(1));
     $this->_customerAccountService->expects($this->once())->method('getCustomer')->with(1)->will($this->returnValue($customerData));
     $customer = $this->_block->getCustomer();
     $this->assertSame($customerData, $customer);
     $this->assertEquals('John', $customer->getFirstname());
     $this->assertEquals('Doe', $customer->getLastname());
 }