function LanguageNegotiationContentEntityTest::createTranslatableEntity

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::createTranslatableEntity()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::createTranslatableEntity()
  3. 11.x 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 170

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.