function DateTimeHandlerTestBase::setUp
Same name in other branches
- 8.9.x core/modules/datetime/src/Tests/Views/DateTimeHandlerTestBase.php \Drupal\datetime\Tests\Views\DateTimeHandlerTestBase::setUp()
- 8.9.x core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setUp()
- 10 core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setUp()
- 11.x core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php \Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase::setUp()
Overrides ViewsKernelTestBase::setUp
5 calls to DateTimeHandlerTestBase::setUp()
- ArgumentDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ ArgumentDateTimeTest.php - FilterDateTest::setUp in core/
modules/ datetime_range/ tests/ src/ Kernel/ Views/ FilterDateTest.php - Create nodes with relative date range of: yesterday - today, today - today, and today - tomorrow.
- FilterDateTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTest.php - Create nodes with relative dates of yesterday, today, and tomorrow.
- FilterDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTimeTest.php - SortDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ SortDateTimeTest.php
5 methods override DateTimeHandlerTestBase::setUp()
- ArgumentDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ ArgumentDateTimeTest.php - FilterDateTest::setUp in core/
modules/ datetime_range/ tests/ src/ Kernel/ Views/ FilterDateTest.php - Create nodes with relative date range of: yesterday - today, today - today, and today - tomorrow.
- FilterDateTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTest.php - Create nodes with relative dates of yesterday, today, and tomorrow.
- FilterDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTimeTest.php - SortDateTimeTest::setUp in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ SortDateTimeTest.php
File
-
core/
modules/ datetime/ tests/ src/ Kernel/ Views/ DateTimeHandlerTestBase.php, line 57
Class
- DateTimeHandlerTestBase
- Base class for testing datetime handlers.
Namespace
Drupal\Tests\datetime\Kernel\ViewsCode
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->installSchema('node', 'node_access');
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add a date field to page nodes.
$node_type = NodeType::create([
'type' => 'page',
'name' => 'page',
]);
$node_type->save();
$fieldStorage = FieldStorageConfig::create([
'field_name' => static::$field_name,
'entity_type' => 'node',
'type' => static::$field_type,
'settings' => [
'datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME,
],
]);
$fieldStorage->save();
$field = FieldConfig::create([
'field_storage' => $fieldStorage,
'bundle' => 'page',
'required' => TRUE,
]);
$field->save();
// Views needs to be aware of the new field.
$this->container
->get('views.views_data')
->clear();
// Set column map.
$this->map = [
'nid' => 'nid',
];
// Load test views.
ViewTestData::createTestViews(static::class, [
'datetime_test',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.