3 namespace Drupal\Tests\taxonomy\Functional;
6 * Tests content translation for vocabularies.
10 class VocabularyTranslationTest extends TaxonomyTestBase {
15 public static $modules = ['content_translation', 'language'];
20 protected function setUp() {
23 // Create an administrative user.
24 $this->drupalLogin($this->drupalCreateUser([
25 'administer taxonomy',
26 'administer content translation',
31 * Tests language settings for vocabularies.
33 public function testVocabularyLanguage() {
34 $this->drupalGet('admin/structure/taxonomy/add');
36 // Check that the field to enable content translation is available.
37 $this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
39 // Create the vocabulary.
40 $vid = mb_strtolower($this->randomMachineName());
41 $edit['name'] = $this->randomMachineName();
42 $edit['description'] = $this->randomMachineName();
43 $edit['langcode'] = 'en';
45 $edit['default_language[content_translation]'] = TRUE;
46 $this->drupalPostForm(NULL, $edit, t('Save'));
48 // Check if content translation is enabled on the edit page.
49 $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
50 $this->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');