SelectTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Multishipping\Block\Checkout\Address;
  7. use Magento\TestFramework\Helper\Bootstrap;
  8. /**
  9. * @magentoAppArea frontend
  10. */
  11. class SelectTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /** @var \Magento\Multishipping\Block\Checkout\Address\Select */
  14. protected $_selectBlock;
  15. protected function setUp()
  16. {
  17. $this->_selectBlock = Bootstrap::getObjectManager()->create(
  18. \Magento\Multishipping\Block\Checkout\Address\Select::class
  19. );
  20. parent::setUp();
  21. }
  22. /**
  23. * @magentoDataFixture Magento/Customer/_files/customer.php
  24. * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
  25. */
  26. public function testGetAddressAsHtml()
  27. {
  28. /** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */
  29. $addressRepository = Bootstrap::getObjectManager()->create(
  30. \Magento\Customer\Api\AddressRepositoryInterface::class
  31. );
  32. $fixtureAddressId = 1;
  33. $address = $addressRepository->getById($fixtureAddressId);
  34. $addressAsHtml = $this->_selectBlock->getAddressAsHtml($address);
  35. $this->assertEquals(
  36. "John Smith<br />CompanyName<br />Green str, 67<br />CityM, Alabama, 75477"
  37. . "<br />United States<br />T: <a href=\"tel:3468676\">3468676</a>",
  38. str_replace("\n", '', $addressAsHtml),
  39. "Address was represented as HTML incorrectly"
  40. );
  41. }
  42. }