You are here

protected function TestItemTest::setUp in Drupal 8

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

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

Overrides FieldKernelTestBase::setUp

File

core/modules/field/tests/src/Kernel/TestItemTest.php, line 33

Class

TestItemTest
Tests the new entity API for the test field type.

Namespace

Drupal\Tests\field\Kernel

Code

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

  // Create a 'test_field' field and storage for validation.
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => 'entity_test',
    'type' => 'test_field',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => $this->fieldName,
    'bundle' => 'entity_test',
  ])
    ->save();
}