function FilterUITest::testFilterInOperatorUi

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/FilterUITest.php \Drupal\Tests\views_ui\Functional\FilterUITest::testFilterInOperatorUi()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/FilterUITest.php \Drupal\Tests\views_ui\Functional\FilterUITest::testFilterInOperatorUi()
  3. 10 core/modules/views_ui/tests/src/Functional/FilterUITest.php \Drupal\Tests\views_ui\Functional\FilterUITest::testFilterInOperatorUi()

Tests that an option for a filter is saved as expected from the UI.

File

core/modules/views_ui/tests/src/Functional/FilterUITest.php, line 42

Class

FilterUITest
Tests for the filters from the UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testFilterInOperatorUi() : void {
    $admin_user = $this->drupalCreateUser([
        'administer views',
        'administer site configuration',
    ]);
    $this->drupalLogin($admin_user);
    $path = 'admin/structure/views/nojs/handler/test_filter_in_operator_ui/default/filter/type';
    $this->drupalGet($path);
    // Verifies that "Limit list to selected items" option is not selected.
    $this->assertSession()
        ->fieldValueEquals('options[expose][reduce]', FALSE);
    // Select "Limit list to selected items" option and apply.
    $edit = [
        'options[expose][reduce]' => TRUE,
    ];
    $this->drupalGet($path);
    $this->submitForm($edit, 'Apply');
    // Verifies that the option was saved as expected.
    $this->drupalGet($path);
    $this->assertSession()
        ->fieldValueEquals('options[expose][reduce]', TRUE);
}

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