function FieldKernelTestBase::setUp

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

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

Overrides KernelTestBase::setUp

31 calls to FieldKernelTestBase::setUp()
BooleanItemTest::setUp in core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php
Set the default field storage backend for fields created during tests.
BulkDeleteTest::setUp in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Set the default field storage backend for fields created during tests.
CommentItemTest::setUp in core/modules/comment/tests/src/Kernel/CommentItemTest.php
Set the default field storage backend for fields created during tests.
ConfigFieldDefinitionTest::setUp in core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php
Set the default field storage backend for fields created during tests.
DateRangeItemTest::setUp in core/modules/datetime_range/tests/src/Kernel/DateRangeItemTest.php
Set the default field storage backend for fields created during tests.

... See full list

31 methods override FieldKernelTestBase::setUp()
BooleanItemTest::setUp in core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php
Set the default field storage backend for fields created during tests.
BulkDeleteTest::setUp in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Set the default field storage backend for fields created during tests.
CommentItemTest::setUp in core/modules/comment/tests/src/Kernel/CommentItemTest.php
Set the default field storage backend for fields created during tests.
ConfigFieldDefinitionTest::setUp in core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php
Set the default field storage backend for fields created during tests.
DateRangeItemTest::setUp in core/modules/datetime_range/tests/src/Kernel/DateRangeItemTest.php
Set the default field storage backend for fields created during tests.

... See full list

File

core/modules/field/tests/src/Kernel/FieldKernelTestBase.php, line 55

Class

FieldKernelTestBase
Parent class for Field API unit tests.

Namespace

Drupal\Tests\field\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->fieldTestData = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
    $this->installEntitySchema('entity_test');
    $this->installEntitySchema('user');
    // Set default storage backend and configure the theme system.
    $this->installConfig([
        'field',
        'system',
        'user',
    ]);
    // Create user 1.
    $storage = \Drupal::entityTypeManager()->getStorage('user');
    $storage->create([
        'uid' => 1,
        'name' => 'entity-test',
        'mail' => 'entity@localhost',
        'status' => TRUE,
    ])
        ->save();
}

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