class MigrateTaxonomyVocabularyTranslationTest

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

Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.

@group migrate_drupal_7

Hierarchy

Expanded class hierarchy of MigrateTaxonomyVocabularyTranslationTest

File

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

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7
View source
class MigrateTaxonomyVocabularyTranslationTest extends MigrateDrupal7TestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'config_translation',
    'language',
    'taxonomy',
    'text',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->executeMigrations([
      'language',
      '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'));
  }

}

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