function MigrateTaxonomyVocabularyTest::assertEntity

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

Validate a migrated vocabulary contains the expected values.

@internal

Parameters

string $id: Entity ID to load and check.

$expected_label: The label the migrated entity should have.

$expected_description: The description the migrated entity should have.

$expected_weight: The weight the migrated entity should have.

2 calls to MigrateTaxonomyVocabularyTest::assertEntity()
MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary in core/modules/forum/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php
Tests the Drupal 7 taxonomy vocabularies to Drupal 8 migration.
MigrateTaxonomyVocabularyTest::testTaxonomyVocabulary in core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php
Tests the Drupal 7 taxonomy vocabularies to Drupal 8 migration.

File

core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyVocabularyTest.php, line 45

Class

MigrateTaxonomyVocabularyTest
Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.

Namespace

Drupal\Tests\taxonomy\Kernel\Migrate\d7

Code

protected function assertEntity(string $id, string $expected_label, string $expected_description, int $expected_weight) : void {
    
    /** @var \Drupal\taxonomy\VocabularyInterface $entity */
    $entity = Vocabulary::load($id);
    $this->assertInstanceOf(VocabularyInterface::class, $entity);
    $this->assertSame($expected_label, $entity->label());
    $this->assertSame($expected_description, $entity->getDescription());
    $this->assertSame($expected_weight, (int) $entity->get('weight'));
}

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