You are here

protected function EntityEmbedFilterTranslationTest::setUp in Entity Embed 8

Overrides EntityEmbedFilterTestBase::setUp

File

tests/src/Kernel/EntityEmbedFilterTranslationTest.php, line 25

Class

EntityEmbedFilterTranslationTest
Tests that entity embeds are translated based on host and `data-langcode`.

Namespace

Drupal\Tests\entity_embed\Kernel

Code

protected function setUp() {
  parent::setUp();
  ConfigurableLanguage::createFromLangcode('pt-br')
    ->save();

  // Reload the entity to ensure it is aware of the newly created language.
  $this->embeddedEntity = $this->container
    ->get('entity_type.manager')
    ->getStorage($this->embeddedEntity
    ->getEntityTypeId())
    ->load($this->embeddedEntity
    ->id());
  $this->embeddedEntity
    ->addTranslation('pt-br')
    ->setTitle('Embed em portugues')
    ->save();
}