function VocabularyLanguageTest::testVocabularyLanguage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php \Drupal\taxonomy\Tests\VocabularyLanguageTest::testVocabularyLanguage()
Tests language settings for vocabularies.
File
- core/
modules/ taxonomy/ src/ Tests/ VocabularyLanguageTest.php, line 44 - Contains \Drupal\taxonomy\Tests\VocabularyLanguageTest.
Class
- VocabularyLanguageTest
- Tests the language functionality for vocabularies.
Namespace
Drupal\taxonomy\TestsCode
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 = Unicode::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.');
}