protected function FieldTest::assertEntity in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/commerce/tests/src/Kernel/Migrate/commerce1/FieldTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\FieldTest::assertEntity()
- 3.1.x modules/commerce/tests/src/Kernel/Migrate/commerce1/FieldTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\FieldTest::assertEntity()
Asserts various aspects of a field_storage_config entity.
Parameters
string $id: The entity ID in the form ENTITY_TYPE.FIELD_NAME.
string $type: The expected field type.
bool $translatable: Whether or not the field is expected to be translatable.
int $cardinality: The expected cardinality of the field.
array $dependencies: The field's dependencies.
1 call to FieldTest::assertEntity()
- FieldTest::testField in modules/
commerce/ tests/ src/ Kernel/ Migrate/ commerce1/ FieldTest.php - Test field migration from Drupal 7 to Drupal 8.
File
- modules/
commerce/ tests/ src/ Kernel/ Migrate/ commerce1/ FieldTest.php, line 73
Class
- FieldTest
- Tests field migration.
Namespace
Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1Code
protected function assertEntity($id, $type, $translatable, $cardinality, array $dependencies) {
list($entity_type) = explode('.', $id);
/** @var \Drupal\field\FieldStorageConfigInterface $field */
$field = FieldStorageConfig::load($id);
$this
->assertTrue($field instanceof FieldStorageConfigInterface);
$this
->assertSame($type, $field
->getType());
$this
->assertEquals($translatable, $field
->isTranslatable());
$this
->assertSame($entity_type, $field
->getTargetEntityTypeId());
$this
->assertSame($dependencies, $field
->getDependencies());
if ($cardinality === 1) {
$this
->assertFalse($field
->isMultiple());
}
else {
$this
->assertTrue($field
->isMultiple());
}
$this
->assertSame($cardinality, $field
->getCardinality());
}