function FilterDateTest::_testFilterDatetimeUI

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::_testFilterDatetimeUI()
  2. 10 core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::_testFilterDatetimeUI()
  3. 11.x core/modules/views/tests/src/Functional/Handler/FilterDateTest.php \Drupal\Tests\views\Functional\Handler\FilterDateTest::_testFilterDatetimeUI()

Tests datetime grouped filter UI.

1 call to FilterDateTest::_testFilterDatetimeUI()
FilterDateTest::testDateFilter in core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
Runs other test methods.

File

core/modules/views/tests/src/Functional/Handler/FilterDateTest.php, line 309

Class

FilterDateTest
Tests the core Drupal\views\Plugin\views\filter\Date handler.

Namespace

Drupal\Tests\views\Functional\Handler

Code

protected function _testFilterDatetimeUI() {
    $this->drupalLogin($this->drupalCreateUser([
        'administer views',
    ]));
    $this->drupalGet('admin/structure/views/nojs/add-handler/test_filter_date_between/default/filter');
    $this->submitForm([
        'name[node__field_date.field_date_value]' => 'node__field_date.field_date_value',
    ], 'Add and configure filter criteria');
    $this->submitForm([], 'Expose filter');
    $this->submitForm([], 'Grouped filters');
    $edit = [];
    $edit['options[group_info][group_items][1][title]'] = 'simple-offset';
    $edit['options[group_info][group_items][1][operator]'] = '>';
    $edit['options[group_info][group_items][1][value][type]'] = 'offset';
    $edit['options[group_info][group_items][1][value][value]'] = '+1 hour';
    $edit['options[group_info][group_items][2][title]'] = 'between-offset';
    $edit['options[group_info][group_items][2][operator]'] = 'between';
    $edit['options[group_info][group_items][2][value][type]'] = 'offset';
    $edit['options[group_info][group_items][2][value][min]'] = '+1 hour';
    $edit['options[group_info][group_items][2][value][max]'] = '+2 days';
    $edit['options[group_info][group_items][3][title]'] = 'between-date';
    $edit['options[group_info][group_items][3][operator]'] = 'between';
    $edit['options[group_info][group_items][3][value][min]'] = $this->dateFormatter
        ->format(150000, 'custom', 'Y-m-d H:i:s');
    $edit['options[group_info][group_items][3][value][max]'] = $this->dateFormatter
        ->format(250000, 'custom', 'Y-m-d H:i:s');
    $this->submitForm($edit, 'Apply');
    $this->drupalGet('admin/structure/views/view/test_filter_date_between');
    $this->submitForm([], 'Save');
    $this->assertConfigSchemaByName('views.view.test_filter_date_between');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.