protected function MigrateFieldTest::assertEntity in Inline Entity Form 8
Asserts various aspects of a field_storage_config entity.
Parameters
string $id: The entity ID in the form ENTITY_TYPE.FIELD_NAME.
string $expected_type: The expected field type.
bool $expected_translatable: Whether or not the field is expected to be translatable.
int $expected_cardinality: The expected cardinality of the field.
1 call to MigrateFieldTest::assertEntity()
- MigrateFieldTest::testFields in tests/
src/ Kernel/ Migrate/ MigrateFieldTest.php - Tests migrating D7 fields to field_storage_config entities.
File
- tests/
src/ Kernel/ Migrate/ MigrateFieldTest.php, line 43
Class
- MigrateFieldTest
- Tests migration of inline_entity_form fields.
Namespace
Drupal\Tests\inline_entity_form\Kernel\MigrateCode
protected function assertEntity($id, $expected_type, $expected_translatable, $expected_cardinality) {
list($expected_entity_type, $expected_name) = explode('.', $id);
/** @var \Drupal\field\FieldStorageConfigInterface $field */
$field = FieldStorageConfig::load($id);
$this
->assertInstanceOf(FieldStorageConfigInterface::class, $field);
$this
->assertEquals($expected_name, $field
->getName());
$this
->assertEquals($expected_type, $field
->getType());
$this
->assertEquals($expected_translatable, $field
->isTranslatable());
$this
->assertEquals($expected_entity_type, $field
->getTargetEntityTypeId());
if ($expected_cardinality === 1) {
$this
->assertFalse($field
->isMultiple());
}
else {
$this
->assertTrue($field
->isMultiple());
}
$this
->assertEquals($expected_cardinality, $field
->getCardinality());
}