You are here

public function FilterUITest::testFilterInOperatorUi in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/FilterUITest.php \Drupal\Tests\views_ui\Functional\FilterUITest::testFilterInOperatorUi()
  2. 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 43

Class

FilterUITest
Tests for the filters from the UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testFilterInOperatorUi() {
  $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
    ->assertFieldByName('options[expose][reduce]', FALSE);

  // Select "Limit list to selected items" option and apply.
  $edit = [
    'options[expose][reduce]' => TRUE,
  ];
  $this
    ->drupalPostForm($path, $edit, t('Apply'));

  // Verifies that the option was saved as expected.
  $this
    ->drupalGet($path);
  $this
    ->assertFieldByName('options[expose][reduce]', TRUE);
}