protected function DateTimeItemTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::setUp()
- 9 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::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() : void {
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();
}