You are here

protected function GeolocationGeometryGeometryTest::setUp in Geolocation Field 8.3

Set the default field storage backend for fields created during tests.

Overrides FieldKernelTestBase::setUp

File

modules/geolocation_geometry/tests/src/Kernel/GeolocationGeometryGeometryTest.php, line 29

Class

GeolocationGeometryGeometryTest
Tests the new entity API for the geolocation field type.

Namespace

Drupal\Tests\geolocation_geometry\Kernel

Code

protected function setUp() {
  parent::setUp();

  // Create a geolocation field storage and field for validation.
  FieldStorageConfig::create([
    'field_name' => 'field_geometry',
    'entity_type' => 'entity_test',
    'type' => 'geolocation_geometry_geometry',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_geometry',
    'label' => 'Geolocation Geometry',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ])
    ->save();

  // Create a geolocation field storage and field for validation.
  FieldStorageConfig::create([
    'field_name' => 'field_polygon',
    'entity_type' => 'entity_test',
    'type' => 'geolocation_geometry_polygon',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_polygon',
    'label' => 'Geolocation Polygon',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ])
    ->save();
}