1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Multishipping\Block\Checkout\Address;
use Magento\TestFramework\Helper\Bootstrap;
/**
* @magentoAppArea frontend
*/
class SelectTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Multishipping\Block\Checkout\Address\Select */
protected $_selectBlock;
protected function setUp()
{
$this->_selectBlock = Bootstrap::getObjectManager()->create(
\Magento\Multishipping\Block\Checkout\Address\Select::class
);
parent::setUp();
}
/**
* @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::class
);
$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: <a href=\"tel:3468676\">3468676</a>",
str_replace("\n", '', $addressAsHtml),
"Address was represented as HTML incorrectly"
);
}
}