function VocabularyTranslationTest::testVocabularyLanguage

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

Tests language settings for vocabularies.

File

core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php, line 59

Class

VocabularyTranslationTest
Tests content translation for vocabularies.

Namespace

Drupal\Tests\taxonomy\Functional

Code

public function testVocabularyLanguage() : void {
    $this->drupalGet('admin/structure/taxonomy/add');
    // Check that the field to enable content translation is available.
    $this->assertSession()
        ->fieldExists('edit-default-language-content-translation');
    // Create the vocabulary.
    $vid = $this->randomMachineName();
    $edit['name'] = $this->randomMachineName();
    $edit['description'] = $this->randomMachineName();
    $edit['langcode'] = 'en';
    $edit['vid'] = $vid;
    $edit['default_language[content_translation]'] = TRUE;
    $this->submitForm($edit, 'Save');
    // Check if content translation is enabled on the edit page.
    $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
    $this->assertSession()
        ->checkboxChecked('edit-default-language-content-translation');
}

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