function VocabularyLanguageTest::testVocabularyLanguage
Tests language settings for vocabularies.
File
- 
              core/modules/ taxonomy/ tests/ src/ Functional/ VocabularyLanguageTest.php, line 46 
Class
- VocabularyLanguageTest
- Tests the language functionality for vocabularies.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testVocabularyLanguage() {
  $this->drupalGet('admin/structure/taxonomy/add');
  // Check that we have the language selector available.
  $this->assertSession()
    ->fieldExists('edit-langcode');
  // Create the vocabulary.
  $vid = mb_strtolower($this->randomMachineName());
  $edit['name'] = $this->randomMachineName();
  $edit['description'] = $this->randomMachineName();
  $edit['langcode'] = 'aa';
  $edit['vid'] = $vid;
  $this->submitForm($edit, 'Save');
  // Check the language on the edit page.
  $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
  $this->assertTrue($this->assertSession()
    ->optionExists('edit-langcode', $edit['langcode'])
    ->isSelected());
  // Change the language and save again.
  $edit['langcode'] = 'bb';
  unset($edit['vid']);
  $this->submitForm($edit, 'Save');
  // Check again the language on the edit page.
  $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
  $this->assertTrue($this->assertSession()
    ->optionExists('edit-langcode', $edit['langcode'])
    ->isSelected());
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
