function 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 120

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

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