function MigrateVocabularyFieldInstanceTest::assertEntityReferenceFields

Same name in other branches
  1. 10 core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php \Drupal\Tests\forum\Kernel\Migrate\d6\MigrateVocabularyFieldInstanceTest::assertEntityReferenceFields()

Asserts the settings of an entity reference field config entity.

@internal

Parameters

string $id: The entity ID in the form ENTITY_TYPE.BUNDLE.FIELD_NAME.

string[] $target_bundles: An array of expected target bundles.

File

core/modules/forum/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldInstanceTest.php, line 115

Class

MigrateVocabularyFieldInstanceTest
Vocabulary field instance migration.

Namespace

Drupal\Tests\forum\Kernel\Migrate\d6

Code

protected function assertEntityReferenceFields(string $id, array $target_bundles) : void {
    $field = FieldConfig::load($id);
    $handler_settings = $field->getSetting('handler_settings');
    $this->assertArrayHasKey('target_bundles', $handler_settings);
    foreach ($handler_settings['target_bundles'] as $target_bundle) {
        $this->assertContains($target_bundle, $target_bundles);
    }
}

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