You are here

public function MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms in Drupal 8

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

Tests the Drupal 6 i18n localized taxonomy term to Drupal 8 migration.

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php, line 112

Class

MigrateTermLocalizedTranslationTest
Tests migration of localized translated taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

Code

public function testTranslatedLocalizedTaxonomyTerms() {
  $this
    ->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', '0', []);
  $this
    ->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', '0', []);

  /** @var \Drupal\taxonomy\TermInterface $entity */
  $entity = Term::load(19);
  $this
    ->assertFalse($entity
    ->hasTranslation('fr'));
  $this
    ->assertTrue($entity
    ->hasTranslation('is'));
  $translation = $entity
    ->getTranslation('is');
  $this
    ->assertSame('Jupiter Station', $translation
    ->label());
  $this
    ->assertSame('is - Holographic research. (localized)', $translation
    ->getDescription());
  $entity = Term::load(20);
  $this
    ->assertFalse($entity
    ->hasTranslation('is'));
  $this
    ->assertTrue($entity
    ->hasTranslation('fr'));
  $translation = $entity
    ->getTranslation('fr');
  $this
    ->assertSame('fr - DS9 (localized)', $translation
    ->label());
  $this
    ->assertSame('fr - Terok Nor (localized)', $translation
    ->getDescription());
  $this
    ->assertFALSE($entity
    ->hasTranslation('is'));
}