function FilterDateTest::_testUiValidation

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

Make sure the validation callbacks works.

1 call to FilterDateTest::_testUiValidation()
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 198

Class

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

Namespace

Drupal\Tests\views\Functional\Handler

Code

protected function _testUiValidation() {
    $this->drupalLogin($this->drupalCreateUser([
        'administer views',
        'administer site configuration',
    ]));
    $this->drupalGet('admin/structure/views/view/test_filter_date_between/edit');
    $this->drupalGet('admin/structure/views/nojs/handler/test_filter_date_between/default/filter/created');
    $edit = [];
    // Generate a definitive wrong value, which should be checked by validation.
    $edit['options[value][value]'] = $this->randomString() . '-------';
    $this->submitForm($edit, 'Apply');
    $this->assertSession()
        ->pageTextContains('Invalid date format.');
}

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