function TestObjectItemTest::setUp

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

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

Overrides FieldKernelTestBase::setUp

File

core/modules/field/tests/src/Kernel/TestObjectItemTest.php, line 26

Class

TestObjectItemTest
Tests the serialization of an object.

Namespace

Drupal\Tests\field\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  // Create a 'test_field' field and storage for validation.
  FieldStorageConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'type' => 'test_object_field',
  ])->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test',
    'bundle' => 'entity_test',
  ])->save();
}

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