protected function FilterDateTest::_testUiValidation

Make sure the validation callbacks works.

1 call to FilterDateTest::_testUiValidation()
FilterDateTest::testDateFilter in drupal/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php
Runs other test methods.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php, line 151
Definition of Drupal\views\Tests\Handler\FilterDateTest.

Class

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

Namespace

Drupal\views\Tests\Handler

Code

protected function _testUiValidation() {
  $view = views_get_view('test_filter_date_between');
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer views',
    'administer site configuration',
  )));
  menu_router_rebuild();
  $this
    ->drupalGet('admin/structure/views/view/test_filter_date_between/edit');
  $this
    ->drupalGet('admin/structure/views/nojs/config-item/test_filter_date_between/default/filter/created');
  $edit = array();

  // Generate a definitive wrong value, which should be checked by validation.
  $edit['options[value][value]'] = $this
    ->randomString() . '-------';
  $this
    ->drupalPost(NULL, $edit, t('Apply'));
  $this
    ->assertText(t('Invalid date format.'), 'Make sure that validation is runned and the invalidate date format is identified.');
}