function TermLanguageTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php \Drupal\Tests\taxonomy\Functional\TermLanguageTest::setUp()
  2. 8.9.x core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php \Drupal\Tests\taxonomy\Functional\TermLanguageTest::setUp()
  3. 10 core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php \Drupal\Tests\taxonomy\Functional\TermLanguageTest::setUp()

Overrides TaxonomyTestBase::setUp

File

core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php, line 34

Class

TermLanguageTest
Tests the language functionality for the taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Create an administrative user.
    $this->drupalLogin($this->drupalCreateUser([
        'administer taxonomy',
    ]));
    // Create a vocabulary to which the terms will be assigned.
    $this->vocabulary = $this->createVocabulary();
    // Add some custom languages.
    foreach ([
        'aa',
        'bb',
        'cc',
    ] as $language_code) {
        ConfigurableLanguage::create([
            'id' => $language_code,
            'label' => $this->randomMachineName(),
        ])
            ->save();
    }
}

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