function DateTimeItemTest::setUp
Same name in other branches
- 9 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::setUp()
- 10 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::setUp()
- 11.x core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::setUp()
Overrides FieldKernelTestBase::setUp
File
-
core/
modules/ datetime/ tests/ src/ Kernel/ DateTimeItemTest.php, line 43
Class
- DateTimeItemTest
- Tests the new entity API for the date field type.
Namespace
Drupal\Tests\datetime\KernelCode
protected function setUp() {
parent::setUp();
// Create a field with settings to validate.
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => 'field_datetime',
'type' => 'datetime',
'entity_type' => 'entity_test',
'settings' => [
'datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME,
],
]);
$this->fieldStorage
->save();
$this->field = FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'entity_test',
'settings' => [
'default_value' => 'blank',
],
]);
$this->field
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.