Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Tests\taxonomy\Functional;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Tests content translation for vocabularies.
|
Chris@0
|
7 *
|
Chris@0
|
8 * @group taxonomy
|
Chris@0
|
9 */
|
Chris@0
|
10 class VocabularyTranslationTest extends TaxonomyTestBase {
|
Chris@0
|
11
|
Chris@0
|
12 /**
|
Chris@0
|
13 * {@inheritdoc}
|
Chris@0
|
14 */
|
Chris@0
|
15 public static $modules = ['content_translation', 'language'];
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 * {@inheritdoc}
|
Chris@0
|
19 */
|
Chris@0
|
20 protected function setUp() {
|
Chris@0
|
21 parent::setUp();
|
Chris@0
|
22
|
Chris@0
|
23 // Create an administrative user.
|
Chris@0
|
24 $this->drupalLogin($this->drupalCreateUser([
|
Chris@0
|
25 'administer taxonomy',
|
Chris@0
|
26 'administer content translation',
|
Chris@0
|
27 ]));
|
Chris@0
|
28 }
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Tests language settings for vocabularies.
|
Chris@0
|
32 */
|
Chris@0
|
33 public function testVocabularyLanguage() {
|
Chris@0
|
34 $this->drupalGet('admin/structure/taxonomy/add');
|
Chris@0
|
35
|
Chris@0
|
36 // Check that the field to enable content translation is available.
|
Chris@0
|
37 $this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
|
Chris@0
|
38
|
Chris@0
|
39 // Create the vocabulary.
|
Chris@17
|
40 $vid = mb_strtolower($this->randomMachineName());
|
Chris@0
|
41 $edit['name'] = $this->randomMachineName();
|
Chris@0
|
42 $edit['description'] = $this->randomMachineName();
|
Chris@0
|
43 $edit['langcode'] = 'en';
|
Chris@0
|
44 $edit['vid'] = $vid;
|
Chris@0
|
45 $edit['default_language[content_translation]'] = TRUE;
|
Chris@0
|
46 $this->drupalPostForm(NULL, $edit, t('Save'));
|
Chris@0
|
47
|
Chris@0
|
48 // Check if content translation is enabled on the edit page.
|
Chris@0
|
49 $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
|
Chris@0
|
50 $this->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');
|
Chris@0
|
51 }
|
Chris@0
|
52
|
Chris@0
|
53 }
|