3 namespace Drupal\Tests\taxonomy\Functional;
5 use Drupal\Component\Utility\Unicode;
8 * Tests content translation for vocabularies.
12 class VocabularyTranslationTest extends TaxonomyTestBase {
17 public static $modules = ['content_translation', 'language'];
22 protected function setUp() {
25 // Create an administrative user.
26 $this->drupalLogin($this->drupalCreateUser([
27 'administer taxonomy',
28 'administer content translation',
33 * Tests language settings for vocabularies.
35 public function testVocabularyLanguage() {
36 $this->drupalGet('admin/structure/taxonomy/add');
38 // Check that the field to enable content translation is available.
39 $this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
41 // Create the vocabulary.
42 $vid = Unicode::strtolower($this->randomMachineName());
43 $edit['name'] = $this->randomMachineName();
44 $edit['description'] = $this->randomMachineName();
45 $edit['langcode'] = 'en';
47 $edit['default_language[content_translation]'] = TRUE;
48 $this->drupalPostForm(NULL, $edit, t('Save'));
50 // Check if content translation is enabled on the edit page.
51 $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
52 $this->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');