You are here

protected function EntityQueryRelationshipTest::setUp in Dynamic Entity Reference 8

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/EntityQueryRelationshipTest.php, line 71

Class

EntityQueryRelationshipTest
Tests dynamic entity reference relationship data.

Namespace

Drupal\Tests\dynamic_entity_reference\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('entity_test_rev');

  // Create a field.
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'type' => 'dynamic_entity_reference',
    'entity_type' => $this->entityType,
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
    'settings' => [
      'exclude_entity_types' => FALSE,
      'entity_type_ids' => [
        $this->referencedEntityType,
      ],
    ],
  ])
    ->save();
  FieldConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityType,
    'bundle' => $this->bundle,
    'label' => 'Field test',
    'settings' => [],
  ])
    ->save();
}