You are here

protected function MigrateFieldInstanceTest::assertEntityReferenceFields in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceTest::assertEntityReferenceFields()

Asserts the settings of an entity reference field config entity.

Parameters

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

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

1 call to MigrateFieldInstanceTest::assertEntityReferenceFields()
MigrateFieldInstanceTest::testFieldInstances in core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
Tests migrating D7 field instances to field_config entities.

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php, line 90

Class

MigrateFieldInstanceTest
Migrates Drupal 7 field instances.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

protected function assertEntityReferenceFields($id, array $target_bundles) {
  $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);
  }
}