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