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