You are here

public function MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms in Drupal 9

Same name in this branch
  1. 9 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()
  2. 9 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. 8 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()

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

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php, line 116

Class

MigrateTermLocalizedTranslationTest
Tests migration of localized translated taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d6

Code

public function testTranslatedLocalizedTaxonomyTerms() {
  $this
    ->assertEntity(14, 'en', 'Talos IV', 'vocabulary_name_much_longer_th', 'The home of Captain Christopher Pike.', NULL, '0', []);
  $this
    ->assertEntity(15, 'en', 'Vulcan', 'vocabulary_name_much_longer_th', NULL, NULL, '0', []);

  /** @var \Drupal\taxonomy\TermInterface $entity */
  $entity = Term::load(14);
  $this
    ->assertTrue($entity
    ->hasTranslation('fr'));
  $translation = $entity
    ->getTranslation('fr');
  $this
    ->assertSame('fr - Talos IV', $translation
    ->label());
  $this
    ->assertSame('fr - The home of Captain Christopher Pike.', $translation
    ->getDescription());
  $this
    ->assertTrue($entity
    ->hasTranslation('zu'));
  $translation = $entity
    ->getTranslation('zu');
  $this
    ->assertSame('Talos IV', $translation
    ->label());
  $this
    ->assertSame('zu - The home of Captain Christopher Pike.', $translation
    ->getDescription());
  $entity = Term::load(15);
  $this
    ->assertFalse($entity
    ->hasTranslation('fr'));
  $this
    ->assertTrue($entity
    ->hasTranslation('zu'));
  $translation = $entity
    ->getTranslation('zu');
  $this
    ->assertSame('zu - Vulcan', $translation
    ->label());
  $this
    ->assertSame('', $translation
    ->getDescription());
}