protected function FilterDateTimeTest::_testExact in Drupal 9
Same name and namespace in other branches
- 8 core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTimeTest::_testExact()
- 10 core/modules/datetime/tests/src/Kernel/Views/FilterDateTimeTest.php \Drupal\Tests\datetime\Kernel\Views\FilterDateTimeTest::_testExact()
Tests exact date matching.
1 call to FilterDateTimeTest::_testExact()
- FilterDateTimeTest::testDatetimeFilter in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTimeTest.php - Tests filter operations.
File
- core/
modules/ datetime/ tests/ src/ Kernel/ Views/ FilterDateTimeTest.php, line 181
Class
- FilterDateTimeTest
- Tests the Drupal\datetime\Plugin\views\filter\Date handler.
Namespace
Drupal\Tests\datetime\Kernel\ViewsCode
protected function _testExact() {
$view = Views::getView('test_filter_datetime');
$field = static::$field_name . '_value';
// Test between with min and max.
$view
->initHandlers();
$view->filter[$field]->operator = '=';
$view->filter[$field]->value['min'] = '';
$view->filter[$field]->value['max'] = '';
// Use the date from node 3. Use the site timezone (mimics a value entered
// through the UI).
$view->filter[$field]->value['value'] = \Drupal::service('date.formatter')
->format(static::$date, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, static::$timezone);
$view
->setDisplay('default');
$this
->executeView($view);
$expected_result = [
[
'nid' => $this->nodes[3]
->id(),
],
];
$this
->assertIdenticalResultset($view, $expected_result, $this->map);
$view
->destroy();
}