function MigrateTaxonomyTermTranslationTest::assertEntity

Same name in this branch
  1. 9 core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\content_translation\Kernel\Migrate\d6\MigrateTaxonomyTermTranslationTest::assertEntity()
Same name and namespace in other branches
  1. 8.9.x core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\content_translation\Kernel\Migrate\d6\MigrateTaxonomyTermTranslationTest::assertEntity()
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTranslationTest::assertEntity()
  3. 10 core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\content_translation\Kernel\Migrate\d6\MigrateTaxonomyTermTranslationTest::assertEntity()
  4. 10 core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTranslationTest::assertEntity()
  5. 11.x core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\content_translation\Kernel\Migrate\d6\MigrateTaxonomyTermTranslationTest::assertEntity()
  6. 11.x core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTranslationTest::assertEntity()

Validates a migrated term contains the expected values.

@internal

Parameters

int $id: Entity ID to load and check.

string $expected_language: The language code for this term.

string $expected_label: The label the migrated entity should have.

string $expected_vid: The parent vocabulary the migrated entity should have.

string|null $expected_description: The description the migrated entity should have.

string|null $expected_format: The format the migrated entity should have.

int $expected_weight: The weight the migrated entity should have.

array $expected_parents: The parent terms the migrated entity should have.

int $expected_field_integer_value: The value the migrated entity field should have.

int $expected_term_reference_tid: The term reference ID the migrated entity field should have.

1 call to MigrateTaxonomyTermTranslationTest::assertEntity()
MigrateTaxonomyTermTranslationTest::testTaxonomyTermTranslation in core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php
Tests the Drupal i18n taxonomy term to Drupal 8 migration.

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTranslationTest.php, line 89

Class

MigrateTaxonomyTermTranslationTest
Test migration of translated taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

Code

protected function assertEntity(int $id, string $expected_language, string $expected_label, string $expected_vid, ?string $expected_description = '', ?string $expected_format = NULL, int $expected_weight = 0, array $expected_parents = [], int $expected_field_integer_value = NULL, int $expected_term_reference_tid = NULL) : void {
    
    /** @var \Drupal\taxonomy\TermInterface $entity */
    $entity = Term::load($id);
    $this->assertInstanceOf(TermInterface::class, $entity);
    $this->assertSame($expected_language, $entity->language()
        ->getId());
    $this->assertSame($expected_label, $entity->label());
    $this->assertSame($expected_vid, $entity->bundle());
    $this->assertSame($expected_description, $entity->getDescription());
    $this->assertSame($expected_format, $entity->getFormat());
    $this->assertSame($expected_weight, $entity->getWeight());
    $this->assertHierarchy($expected_vid, $id, $expected_parents);
}

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