VocabularyTranslationTest.php

Same filename in this branch
  1. 8.9.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php
Same filename and directory in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php
  2. 9 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php
  3. 9 core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
  4. 10 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php
  5. 10 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php
  6. 10 core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
  7. 11.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php
  8. 11.x core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php
  9. 11.x core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php

Namespace

Drupal\Tests\taxonomy\Functional

File

core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php

View source
<?php

namespace Drupal\Tests\taxonomy\Functional;


/**
 * Tests content translation for vocabularies.
 *
 * @group taxonomy
 */
class VocabularyTranslationTest extends TaxonomyTestBase {
    
    /**
     * {@inheritdoc}
     */
    public static $modules = [
        'content_translation',
        'language',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() {
        parent::setUp();
        // Create an administrative user.
        $this->drupalLogin($this->drupalCreateUser([
            'administer taxonomy',
            'administer content translation',
        ]));
    }
    
    /**
     * Tests language settings for vocabularies.
     */
    public function testVocabularyLanguage() {
        $this->drupalGet('admin/structure/taxonomy/add');
        // Check that the field to enable content translation is available.
        $this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
        // Create the vocabulary.
        $vid = mb_strtolower($this->randomMachineName());
        $edit['name'] = $this->randomMachineName();
        $edit['description'] = $this->randomMachineName();
        $edit['langcode'] = 'en';
        $edit['vid'] = $vid;
        $edit['default_language[content_translation]'] = TRUE;
        $this->drupalPostForm(NULL, $edit, t('Save'));
        // Check if content translation is enabled on the edit page.
        $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
        $this->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');
    }

}

Classes

Title Deprecated Summary
VocabularyTranslationTest Tests content translation for vocabularies.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.