MigrateTaxonomyVocabularyTranslationTest.php

Same filename in this branch
  1. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php
Same filename in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php
  2. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php
  3. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php
  4. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php
  5. 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php
  6. 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php

View source
<?php

namespace Drupal\Tests\taxonomy\Kernel\Migrate\d7;

use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;

/**
 * Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.
 *
 * @group migrate_drupal_7
 */
class MigrateTaxonomyVocabularyTranslationTest extends MigrateDrupal7TestBase {
    
    /**
     * {@inheritdoc}
     */
    public static $modules = [
        'config_translation',
        'language',
        'taxonomy',
        'text',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() {
        parent::setUp();
        $this->executeMigrations([
            'd7_taxonomy_vocabulary',
            'd7_taxonomy_vocabulary_translation',
        ]);
    }
    
    /**
     * Tests the Drupal 7 i18n taxonomy vocabularies to Drupal 8 migration.
     */
    public function testTaxonomyVocabularyTranslation() {
        
        /** @var \Drupal\language\ConfigurableLanguageManagerInterface $language_manager */
        $language_manager = \Drupal::service('language_manager');
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.sujet_de_discussion');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.tags');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.test_vocabulary');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('is', 'taxonomy.vocabulary.test_vocabulary');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('is', 'taxonomy.vocabulary.vocabulary_name_clearly_diffe');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabulary_name_clearly_diffe');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabfixed');
        $this->assertSame('fr - VocabFixed', $config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocablocalized');
        $this->assertSame('fr - VocabLocalized', $config_translation->get('name'));
        $this->assertSame('fr - Vocabulary localize option', $config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('is', 'taxonomy.vocabulary.vocablocalized');
        $this->assertSame('is - VocabLocalized', $config_translation->get('name'));
        $this->assertSame('is - Vocabulary localize option', $config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('fr', 'taxonomy.vocabulary.vocabtranslate');
        $this->assertNull($config_translation->get('name'));
        $this->assertNull($config_translation->get('description'));
        $config_translation = $language_manager->getLanguageConfigOverride('is', 'taxonomy.vocabulary.vocabtranslate');
        $this->assertSame('is - VocabTranslate', $config_translation->get('name'));
        $this->assertSame('is - Vocabulary translate option', $config_translation->get('description'));
    }

}

Classes

Title Deprecated Summary
MigrateTaxonomyVocabularyTranslationTest Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.

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