protected function GeofieldItemTest::createField in Geofield 8
Creates a geofield field storage and field.
Parameters
string $entity_type: Entity type for which the field should be created.
1 call to GeofieldItemTest::createField()
- GeofieldItemTest::testCrudAndUpdate in tests/
src/ Kernel/ GeofieldItemTest.php - Tests processed properties.
File
- tests/
src/ Kernel/ GeofieldItemTest.php, line 100
Class
- GeofieldItemTest
- Tests using entity fields of the geofield field type.
Namespace
Drupal\Tests\geofield\KernelCode
protected function createField($entity_type) {
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => 'geofield_field',
'entity_type' => $entity_type,
'type' => 'geofield',
'settings' => [
'backend' => 'geofield_backend_default',
],
]);
$this->fieldStorage
->save();
$this->field = FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => $entity_type,
'description' => 'Description for geofield_field',
'settings' => [
'backend' => 'geofield_backend_default',
],
'required' => TRUE,
]);
$this->field
->save();
}