You are here

protected function FieldMissingTypeTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()

Overrides EntityKernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php, line 35

Class

FieldMissingTypeTest
Tests the exception when missing a field type.

Namespace

Drupal\KernelTests\Core\Field

Code

protected function setUp() : void {
  parent::setUp();
  $entity_type_id = 'entity_test_mulrev';
  $this
    ->installEntitySchema($entity_type_id);
  $this->fieldName = mb_strtolower($this
    ->randomMachineName());

  /** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'type' => 'text',
    'entity_type' => $entity_type_id,
    'cardinality' => 1,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => $entity_type_id,
    'field_name' => $this->fieldName,
    'bundle' => $entity_type_id,
    'label' => 'Test field',
  ])
    ->save();
}