protected function MigrateFieldInstanceTest::assertEntityReferenceFields in Inline Entity Form 8
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.
string[] $sort: An array of expected sort parameters.
1 call to MigrateFieldInstanceTest::assertEntityReferenceFields()
- MigrateFieldInstanceTest::testFieldInstances in tests/
src/ Kernel/ Migrate/ MigrateFieldInstanceTest.php - Tests migrating D7 field instances to field_config entities.
File
- tests/
src/ Kernel/ Migrate/ MigrateFieldInstanceTest.php, line 77
Class
- MigrateFieldInstanceTest
- Tests migration of inline_entity_form field instances.
Namespace
Drupal\Tests\inline_entity_form\Kernel\MigrateCode
protected function assertEntityReferenceFields($id, array $target_bundles, array $sort) {
$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);
}
$this
->assertArrayHasKey('sort', $handler_settings);
$this
->assertSame($sort, $handler_settings['sort']);
}