You are here

public function ViewsExposedGroupsExposedOperatorTest::testExposedOperator in Views exposed groups 3.0.x

Asserts that a filter with an exposed operator behaves correctly.

File

tests/src/Functional/ViewsExposedGroupsExposedOperatorTest.php, line 51

Class

ViewsExposedGroupsExposedOperatorTest
Tests a view with exposed groups that also has exposed operators.

Namespace

Drupal\Tests\views_exposed_groups\Functional

Code

public function testExposedOperator() {
  $view_path = $this->defaultView
    ->getDisplay('page_1')
    ->getOption('path');
  $this
    ->drupalLogin($this->unprivilegedUser);
  $this
    ->drupalGet($view_path);

  // Asserts that the exposed filter with an exposed operator exists.
  $this
    ->assertFieldByName('title_op');
  $this
    ->assertFieldByName('title');
  $fieldset_legend = $this
    ->xpath('//fieldset/legend/span[text()="Title"]');
  $this
    ->assertEqual(1, count($fieldset_legend), 'Found the exposed filter label as the fieldset legend.');
}