You are here

protected function CommerceMigrateCoreTestTrait::assertVocabularyEntity in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/CommerceMigrateCoreTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateCoreTestTrait::assertVocabularyEntity()
  2. 3.0.x tests/src/Kernel/CommerceMigrateCoreTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateCoreTestTrait::assertVocabularyEntity()

Validate a migrated vocabulary contains the expected values.

Parameters

string $id: Entity ID to load and check.

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

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

string $expected_hierarchy: The hierarchy setting the migrated entity should have.

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

4 calls to CommerceMigrateCoreTestTrait::assertVocabularyEntity()
NodeTest::testNode in modules/commerce/tests/src/Kernel/Migrate/commerce1/NodeTest.php
Test node migration from Commerce 1 to Commerce Drupal 8.
TaxonomyVocabularyTest::testTaxonomyVocabulary in modules/shopify/tests/src/Kernel/Migrate/TaxonomyVocabularyTest.php
Tests Shopify vocabulary migration.
TaxonomyVocabularyTest::testTaxonomyVocabulary in modules/magento/tests/src/Kernel/Migrate/magento2/TaxonomyVocabularyTest.php
Tests Magento 2 category to Drupal 8 vocabulary migration.
TaxonomyVocabularyTest::testTaxonomyVocabulary in modules/woocommerce/tests/src/Kernel/Migrate/woo3/TaxonomyVocabularyTest.php
Tests the Drupal 7 taxonomy vocabularies to Drupal 8 migration.

File

tests/src/Kernel/CommerceMigrateCoreTestTrait.php, line 130

Class

CommerceMigrateCoreTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

protected function assertVocabularyEntity($id, $expected_label, $expected_description, $expected_hierarchy, $expected_weight) {

  /** @var \Drupal\taxonomy\VocabularyInterface $entity */
  $entity = Vocabulary::load($id);
  $this
    ->assertTrue($entity instanceof VocabularyInterface);
  $this
    ->assertSame($expected_label, $entity
    ->label());
  $this
    ->assertSame($expected_description, $entity
    ->getDescription());
  $this
    ->assertSame($expected_weight, $entity
    ->get('weight'));
}