function EntityUrlLanguageTest::createTranslatableEntity

Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::createTranslatableEntity()
  2. 8.9.x core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::createTranslatableEntity()
  3. 11.x core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php \Drupal\Tests\language\Kernel\EntityUrlLanguageTest::createTranslatableEntity()

Creates a translated entity.

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

File

core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php, line 117

Class

EntityUrlLanguageTest
Tests the language of entity URLs. @group language

Namespace

Drupal\Tests\language\Kernel

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.