You are here

protected function LanguageNegotiationContentEntityTest::createTranslatableEntity in Drupal 10

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

Creates a translated entity.

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();
}