function JsonApiFunctionalDateFieldTest::setUp

Same name in other branches
  1. 10 core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalDateFieldTest::setUp()
  2. 11.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalDateFieldTest::setUp()

Overrides JsonApiFunctionalTestBase::setUp

File

core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalDateFieldTest.php, line 29

Class

JsonApiFunctionalDateFieldTest
JSON:API integration test for the "Date" field.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUp() : void {
    parent::setUp();
    FieldStorageConfig::create([
        'field_name' => 'field_datetime',
        'entity_type' => 'node',
        'type' => 'datetime',
        'settings' => [
            'datetime_type' => 'datetime',
        ],
        'cardinality' => 1,
    ])->save();
    FieldConfig::create([
        'field_name' => 'field_datetime',
        'label' => 'Date and time',
        'entity_type' => 'node',
        'bundle' => 'article',
        'required' => FALSE,
        'settings' => [],
        'description' => '',
    ])->save();
}

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