예제 #1
0
 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
  */
 public function testGetAddressAsHtml()
 {
     /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */
     $addressRepository = Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\AddressRepositoryInterface');
     $fixtureAddressId = 1;
     $address = $addressRepository->getById($fixtureAddressId);
     $addressAsHtml = $this->_selectBlock->getAddressAsHtml($address);
     $this->assertEquals("John Smith<br/>CompanyName<br />Green str, 67<br />CityM,  Alabama, 75477" . "<br/>United States<br/>T: 3468676", str_replace("\n", '', $addressAsHtml), "Address was represented as HTML incorrectly");
 }
예제 #2
0
 public function testGetAddressWhenItNotExistInCustomer()
 {
     $searchResultMock = $this->getMock('Magento\\Customer\\Api\\Data\\AddressSearchResultsInterface');
     $this->multishippingMock->expects($this->once())->method('getCustomer')->willReturn($this->customerMock);
     $this->customerMock->expects($this->once())->method('getId')->willReturn(1);
     $this->filterBuilderMock->expects($this->once())->method('setField')->with('parent_id')->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('setValue')->with(1)->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('setConditionType')->with('eq')->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($this->filterMock);
     $this->searchCriteriaBuilderMock->expects($this->once())->method('addFilter')->with([$this->filterMock])->willReturnSelf();
     $this->searchCriteriaBuilderMock->expects($this->once())->method('create')->willReturn($this->searchCriteriaMock);
     $this->addressRepositoryMock->expects($this->once())->method('getList')->with($this->searchCriteriaMock)->willReturn($searchResultMock);
     $searchResultMock->expects($this->once())->method('getItems')->willThrowException(new NoSuchEntityException());
     $this->assertEquals([], $this->block->getAddress());
 }