function MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms

Same name in this branch
  1. 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()
Same name in other branches
  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()
  3. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()
  4. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()
  5. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms()
  6. 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/d6/MigrateTermLocalizedTranslationTest.php, line 122

Class

MigrateTermLocalizedTranslationTest
Tests migration of localized translated taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d6

Code

public function testTranslatedLocalizedTaxonomyTerms() : void {
    $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.