Example #1
0
 public function testCustomerLoggedIn()
 {
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with('Magento_PageCache')->willReturn(true);
     $this->cacheConfigMock->expects($this->once())->method('isEnabled')->willReturn(true);
     $this->weeeHelperMock->expects($this->any())->method('isEnabled')->willReturn(true);
     $customerMock = $this->getMockBuilder('Magento\\Customer\\Model\\Data\\Customer')->disableOriginalConstructor()->getMock();
     $this->observerMock->expects($this->once())->method('getData')->with('customer')->willReturn($customerMock);
     $address = $this->objectManager->getObject('Magento\\Customer\\Model\\Data\\Address');
     $address->setIsDefaultShipping(true);
     $address->setIsDefaultBilling(true);
     $address->setCountryId(1);
     $address->setPostCode(11111);
     $addresses = [$address];
     $customerMock->expects($this->once())->method('getAddresses')->willReturn($addresses);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxBillingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxShippingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->session->customerLoggedIn($this->observerMock);
 }