Pull merge.
[yaffs-website] / web / core / modules / taxonomy / tests / src / Functional / VocabularyTranslationTest.php
1 <?php
2
3 namespace Drupal\Tests\taxonomy\Functional;
4
5 /**
6  * Tests content translation for vocabularies.
7  *
8  * @group taxonomy
9  */
10 class VocabularyTranslationTest extends TaxonomyTestBase {
11
12   /**
13    * {@inheritdoc}
14    */
15   public static $modules = ['content_translation', 'language'];
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function setUp() {
21     parent::setUp();
22
23     // Create an administrative user.
24     $this->drupalLogin($this->drupalCreateUser([
25       'administer taxonomy',
26       'administer content translation',
27     ]));
28   }
29
30   /**
31    * Tests language settings for vocabularies.
32    */
33   public function testVocabularyLanguage() {
34     $this->drupalGet('admin/structure/taxonomy/add');
35
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.');
38
39     // Create the vocabulary.
40     $vid = mb_strtolower($this->randomMachineName());
41     $edit['name'] = $this->randomMachineName();
42     $edit['description'] = $this->randomMachineName();
43     $edit['langcode'] = 'en';
44     $edit['vid'] = $vid;
45     $edit['default_language[content_translation]'] = TRUE;
46     $this->drupalPostForm(NULL, $edit, t('Save'));
47
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.');
51   }
52
53 }