You are here

public function MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation in Drupal 8

Same name in this branch
  1. 8 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation()
  2. 8 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation()
Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation()
  2. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation()

Tests the Drupal 7 i18n taxonomy vocabularies to Drupal 8 migration.

File

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

Class

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

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

Code

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'));
}