function MigrateFieldInstanceTest::assertEntity
Same name in other branches
- 8.9.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceTest::assertEntity()
- 10 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceTest::assertEntity()
- 11.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceTest::assertEntity()
Asserts various aspects of a field config entity.
@internal
Parameters
string $id: The entity ID in the form ENTITY_TYPE.BUNDLE.FIELD_NAME.
string $expected_label: The expected field label.
string $expected_field_type: The expected field type.
bool $is_required: Whether or not the field is required.
bool $expected_translatable: Whether or not the field is expected to be translatable.
1 call to MigrateFieldInstanceTest::assertEntity()
- 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 56
Class
- MigrateFieldInstanceTest
- Migrates Drupal 7 field instances.
Namespace
Drupal\Tests\field\Kernel\Migrate\d7Code
protected function assertEntity(string $id, string $expected_label, string $expected_field_type, bool $is_required, bool $expected_translatable) : void {
[
$expected_entity_type,
$expected_bundle,
$expected_name,
] = explode('.', $id);
/** @var \Drupal\field\FieldConfigInterface $field */
$field = FieldConfig::load($id);
$this->assertInstanceOf(FieldConfigInterface::class, $field);
$this->assertEquals($expected_label, $field->label());
$this->assertEquals($expected_field_type, $field->getType());
$this->assertEquals($expected_entity_type, $field->getTargetEntityTypeId());
$this->assertEquals($expected_bundle, $field->getTargetBundle());
$this->assertEquals($expected_name, $field->getName());
$this->assertEquals($is_required, $field->isRequired());
$this->assertEquals($expected_entity_type . '.' . $expected_name, $field->getFieldStorageDefinition()
->id());
$this->assertEquals($expected_translatable, $field->isTranslatable());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.