public function VocabularyLanguageTest::testVocabularyLanguage in Drupal 9
Same name and namespace in other branches
- 8 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 43
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());
}