function TimestampItemTest::setUp

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

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();
}

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