function FilterDateTest::setUp
Same name in this branch
- 8.9.x core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest::setUp()
- 8.9.x core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTest::setUp()
- 8.9.x core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php \Drupal\Tests\datetime\Functional\Views\FilterDateTest::setUp()
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::setUp()
- 9 core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest::setUp()
- 9 core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTest::setUp()
- 9 core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php \Drupal\Tests\datetime\Functional\Views\FilterDateTest::setUp()
- 10 core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::setUp()
- 10 core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest::setUp()
- 10 core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTest::setUp()
- 10 core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php \Drupal\Tests\datetime\Functional\Views\FilterDateTest::setUp()
- 11.x core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::setUp()
- 11.x core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest::setUp()
- 11.x core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTest::setUp()
- 11.x core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php \Drupal\Tests\datetime\Functional\Views\FilterDateTest::setUp()
Overrides ViewTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Functional/ Handler/ FilterDateTest.php, line 46
Class
- FilterDateTest
- Tests the core Drupal\views\Plugin\views\filter\Date handler.
Namespace
Drupal\Tests\views\Functional\HandlerCode
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->dateFormatter = $this->container
->get('date.formatter');
// Add a date field so we can test datetime handling.
NodeType::create([
'type' => 'page',
'name' => 'Page',
])->save();
// Setup a field storage and field, but also change the views data for the
// entity_test entity type.
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_date',
'type' => 'datetime',
'entity_type' => 'node',
]);
$field_storage->save();
$field = FieldConfig::create([
'field_name' => 'field_date',
'entity_type' => 'node',
'bundle' => 'page',
]);
$field->save();
// Add some basic test nodes.
$this->nodes = [];
$this->nodes[] = $this->drupalCreateNode([
'created' => 100000,
'field_date' => 10000,
]);
$this->nodes[] = $this->drupalCreateNode([
'created' => 200000,
'field_date' => 20000,
]);
$this->nodes[] = $this->drupalCreateNode([
'created' => 300000,
'field_date' => 30000,
]);
$this->nodes[] = $this->drupalCreateNode([
'created' => time() + 86400,
'field_date' => time() + 86400,
]);
$this->map = [
'nid' => 'nid',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.