function FieldValidationTest::setUp

Same name in other branches
  1. 8.9.x core/modules/field/tests/src/Kernel/FieldValidationTest.php \Drupal\Tests\field\Kernel\FieldValidationTest::setUp()
  2. 10 core/modules/field/tests/src/Kernel/FieldValidationTest.php \Drupal\Tests\field\Kernel\FieldValidationTest::setUp()
  3. 11.x core/modules/field/tests/src/Kernel/FieldValidationTest.php \Drupal\Tests\field\Kernel\FieldValidationTest::setUp()

Overrides FieldKernelTestBase::setUp

File

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

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,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.