function EntityTranslationFormTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php \Drupal\Tests\system\Functional\Entity\EntityTranslationFormTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php \Drupal\Tests\system\Functional\Entity\EntityTranslationFormTest::setUp()
  3. 10 core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php \Drupal\Tests\system\Functional\Entity\EntityTranslationFormTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php, line 38

Class

EntityTranslationFormTest
Tests entity translation form.

Namespace

Drupal\Tests\system\Functional\Entity

Code

protected function setUp() : void {
    parent::setUp();
    // Enable translations for the test entity type.
    \Drupal::state()->set('entity_test.translation', TRUE);
    // Create test languages.
    $this->langcodes = [];
    for ($i = 0; $i < 2; ++$i) {
        $language = ConfigurableLanguage::create([
            'id' => 'l' . $i,
            'label' => $this->randomString(),
        ]);
        $this->langcodes[$i] = $language->id();
        $language->save();
    }
}

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