You are here

protected function LanguageNegotiationContentEntityTest::createTranslatableEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::createTranslatableEntity()
  2. 10 core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::createTranslatableEntity()

Creates a translated entity.

1 call to LanguageNegotiationContentEntityTest::createTranslatableEntity()
LanguageNegotiationContentEntityTest::setUp in core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php

File

core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php, line 168

Class

LanguageNegotiationContentEntityTest
Tests language negotiation with the language negotiator content entity.

Namespace

Drupal\Tests\language\Functional

Code

protected function createTranslatableEntity() {
  $this->entity = EntityTest::create();
  $this->entity
    ->addTranslation('es', [
    'name' => 'name spanish',
  ]);
  $this->entity
    ->addTranslation('fr', [
    'name' => 'name french',
  ]);
  $this->entity
    ->save();
}