public function VocabularyLanguageTest::testVocabularyLanguage in Drupal 8
Same name and namespace in other branches
- 9 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
->assertField('edit-langcode', 'The language selector field was found on the page.');
// Create the vocabulary.
$vid = mb_strtolower($this
->randomMachineName());
$edit['name'] = $this
->randomMachineName();
$edit['description'] = $this
->randomMachineName();
$edit['langcode'] = 'aa';
$edit['vid'] = $vid;
$this
->drupalPostForm(NULL, $edit, t('Save'));
// Check the language on the edit page.
$this
->drupalGet('admin/structure/taxonomy/manage/' . $vid);
$this
->assertOptionSelected('edit-langcode', $edit['langcode'], 'The vocabulary language was correctly selected.');
// Change the language and save again.
$edit['langcode'] = 'bb';
unset($edit['vid']);
$this
->drupalPostForm(NULL, $edit, t('Save'));
// Check again the language on the edit page.
$this
->drupalGet('admin/structure/taxonomy/manage/' . $vid);
$this
->assertOptionSelected('edit-langcode', $edit['langcode'], 'The vocabulary language was correctly selected.');
}