You are here

protected function EntityTranslationFormTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php \Drupal\Tests\system\Functional\Entity\EntityTranslationFormTest::setUp()
  2. 9 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 32

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