Exemple #1
0
 /**
  * Returns the Magento Customer Model for this block
  *
  * @return \Magento\Customer\Api\Data\CustomerInterface|null
  */
 public function getCustomer()
 {
     try {
         return $this->currentCustomer->getCustomer();
     } catch (NoSuchEntityException $e) {
         return null;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getSectionData()
 {
     if (!$this->currentCustomer->getCustomerId()) {
         return [];
     }
     $customer = $this->currentCustomer->getCustomer();
     return ['fullname' => $this->customerViewHelper->getCustomerName($customer), 'firstname' => $customer->getFirstname()];
 }
 /**
  * test get customer method, method returns customer from service
  */
 public function testGetCustomerLoadCustomerFromService()
 {
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(false));
     $this->customerSessionMock->expects($this->once())->method('getId')->will($this->returnValue($this->customerId));
     $this->customerRepositoryMock->expects($this->once())->method('getById')->with($this->equalTo($this->customerId))->will($this->returnValue($this->customerDataMock));
     $this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
 }
Exemple #4
0
 /**
  * Retrieve the Customer Data using the customer Id from the customer session.
  *
  * @return Customer
  */
 public function getCustomer()
 {
     return $this->currentCustomer->getCustomer();
 }