You are here

protected function MigrateTaxonomyTermTest::assertEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyTermTest.php \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomyTermTest::assertEntity()

Validate a migrated term contains the expected values.

Parameters

$id: Entity ID to load and check.

$expected_label: The label the migrated entity should have.

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

string $expected_description: The description 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.

1 call to MigrateTaxonomyTermTest::assertEntity()
MigrateTaxonomyTermTest::testTaxonomyTerms in core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyTermTest.php
Tests the Drupal 7 taxonomy term to Drupal 8 migration.

File

core/modules/taxonomy/src/Tests/Migrate/d7/MigrateTaxonomyTermTest.php, line 48
Contains \Drupal\taxonomy\Tests\Migrate\d7\MigrateTaxonomyTermTest.

Class

MigrateTaxonomyTermTest
Upgrade taxonomy terms.

Namespace

Drupal\taxonomy\Tests\Migrate\d7

Code

protected function assertEntity($id, $expected_label, $expected_vid, $expected_description = '', $expected_weight = 0, $expected_parents = []) {

  /** @var \Drupal\taxonomy\TermInterface $entity */
  $entity = Term::load($id);
  $this
    ->assertTrue($entity instanceof TermInterface);
  $this
    ->assertIdentical($expected_label, $entity
    ->label());
  $this
    ->assertIdentical($expected_vid, $entity
    ->getVocabularyId());
  $this
    ->assertEqual($expected_description, $entity
    ->getDescription());
  $this
    ->assertEqual($expected_weight, $entity
    ->getWeight());
  $this
    ->assertIdentical($expected_parents, $this
    ->getParentIDs($id));
}