protected function MigrateEckTestBase::assertFieldStorage in Entity Construction Kit (ECK) 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 MigrateEckTestBase::assertFieldStorage()
- MigrateEckFieldTest::testFields in tests/
src/ Kernel/ Migrate/ d7/ MigrateEckFieldTest.php - Tests migrating D7 fields to field_storage_config entities.
File
- tests/
src/ Kernel/ Migrate/ d7/ MigrateEckTestBase.php, line 134
Class
- MigrateEckTestBase
- Base class for ECK migration tests.
Namespace
Drupal\Tests\eck\Kernel\Migrate\d7Code
protected function assertFieldStorage($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());
}