function MigrateTermLocalizedTranslationTest::testTranslatedLocalizedTaxonomyTerms

Same name in this branch
  1. 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermLocalizedTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d6\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/d7/MigrateTermLocalizedTranslationTest.php, line 118

Class

MigrateTermLocalizedTranslationTest
Tests migration of localized translated taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

Code

public function testTranslatedLocalizedTaxonomyTerms() : void {
    $this->assertEntity(19, 'en', 'Jupiter Station', 'vocablocalized', 'Holographic research.', 'filtered_html', 0, []);
    $this->assertEntity(20, 'en', 'DS9', 'vocablocalized', 'Terok Nor', 'filtered_html', 0, []);
    $this->assertEntity(25, 'en', 'Emissary', 'vocablocalized2', 'Pilot episode', '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'));
    $entity = Term::load(25);
    $this->assertFalse($entity->hasTranslation('is'));
    $this->assertTrue($entity->hasTranslation('fr'));
    $translation = $entity->getTranslation('fr');
    $this->assertSame('fr - Emissary', $translation->label());
    $this->assertSame('fr - Pilot episode', $translation->getDescription());
}

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