function VocabularyLanguageTest::testVocabularyLanguage
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php \Drupal\Tests\taxonomy\Functional\VocabularyLanguageTest::testVocabularyLanguage()
- 8.9.x core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php \Drupal\Tests\taxonomy\Functional\VocabularyLanguageTest::testVocabularyLanguage()
- 10 core/modules/taxonomy/tests/src/Functional/VocabularyLanguageTest.php \Drupal\Tests\taxonomy\Functional\VocabularyLanguageTest::testVocabularyLanguage()
Tests language settings for vocabularies.
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ VocabularyLanguageTest.php, line 51
Class
- VocabularyLanguageTest
- Tests the language functionality for vocabularies.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testVocabularyLanguage() : void {
$this->drupalGet('admin/structure/taxonomy/add');
// Check that we have the language selector available.
$this->assertSession()
->fieldExists('edit-langcode');
// Create the vocabulary.
$vid = $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.