You are here

protected function TimestampItemTest::setUp in Drupal 8

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

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

Overrides FieldKernelTestBase::setUp

File

core/modules/field/tests/src/Kernel/Timestamp/TimestampItemTest.php, line 36

Class

TimestampItemTest
Tests the timestamp fields.

Namespace

Drupal\Tests\field\Kernel\Timestamp

Code

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

  // Create a field with settings to validate.
  $this->fieldStorage = FieldStorageConfig::create([
    'field_name' => 'field_timestamp',
    'type' => 'timestamp',
    'entity_type' => 'entity_test',
  ]);
  $this->fieldStorage
    ->save();
  $this->field = FieldConfig::create([
    'field_storage' => $this->fieldStorage,
    'bundle' => 'entity_test',
  ]);
  $this->field
    ->save();
}