CountryDefaultFormatterTest.php in Address 8
File
tests/src/Kernel/Formatter/CountryDefaultFormatterTest.php
View source
<?php
namespace Drupal\Tests\address\Kernel\Formatter;
use Drupal\entity_test\Entity\EntityTest;
class CountryDefaultFormatterTest extends FormatterTestBase {
protected function setUp() : void {
parent::setUp();
$this
->createField('address_country', 'address_country_default');
}
public function testRender() {
$entity = EntityTest::create([]);
$entity->{$this->fieldName}->value = 'RS';
$this
->renderEntityFields($entity, $this->display);
$this
->assertRaw('Serbia');
$entity->{$this->fieldName}->value = 'UNKNOWN';
$this
->renderEntityFields($entity, $this->display);
$this
->assertRaw('UNKNOWN');
}
}