You are here

protected function FieldValidationTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Kernel/FieldValidationTest.php \Drupal\Tests\field\Kernel\FieldValidationTest::setUp()

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

Overrides FieldKernelTestBase::setUp

File

core/modules/field/tests/src/Kernel/FieldValidationTest.php, line 27

Class

FieldValidationTest
Tests field validation.

Namespace

Drupal\Tests\field\Kernel

Code

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

  // Create a field and storage of type 'test_field', on the 'entity_test'
  // entity type.
  $this->entityType = 'entity_test';
  $this->bundle = 'entity_test';
  $this
    ->createFieldWithStorage('', $this->entityType, $this->bundle);

  // Create an 'entity_test' entity.
  $this->entity = \Drupal::entityTypeManager()
    ->getStorage($this->entityType)
    ->create([
    'type' => $this->bundle,
  ]);
}