public function AddressDefaultFormatterTest::testAndorraAddress in Address 8
Tests Andorra address formatting.
File
- tests/
src/ Kernel/ Formatter/ AddressDefaultFormatterTest.php, line 29
Class
- AddressDefaultFormatterTest
- Tests the address_default formatter.
Namespace
Drupal\Tests\address\Kernel\FormatterCode
public function testAndorraAddress() {
$entity = EntityTest::create([]);
$entity->{$this->fieldName} = [
'country_code' => 'AD',
'locality' => 'Canillo',
'postal_code' => 'AD500',
'address_line1' => 'C. Prat de la Creu, 62-64',
];
$this
->renderEntityFields($entity, $this->display);
// Andorra has no predefined administrative areas, but it does have
// predefined localities, which must be shown.
$expected = implode('', [
'line1' => '<p class="address" translate="no">',
'line2' => '<span class="address-line1">C. Prat de la Creu, 62-64</span><br>' . "\n",
'line3' => '<span class="postal-code">AD500</span> <span class="locality">Canillo</span><br>' . "\n",
'line4' => '<span class="country">Andorra</span>',
'line5' => '</p>',
]);
$this
->assertRaw($expected, 'The AD address has been properly formatted.');
}