You are here

public function FilterBooleanOperatorStringTest::testFilterGroupedExposed in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FilterBooleanOperatorStringTest.php \Drupal\views\Tests\Handler\FilterBooleanOperatorStringTest::testFilterGroupedExposed()

Tests the Boolean filter with grouped exposed form enabled.

File

core/modules/views/src/Tests/Handler/FilterBooleanOperatorStringTest.php, line 154
Contains \Drupal\views\Tests\Handler\FilterBooleanOperatorStringTest.

Class

FilterBooleanOperatorStringTest
Tests the core Drupal\views\Plugin\views\filter\BooleanOperatorString handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testFilterGroupedExposed() {
  $filters = $this
    ->getGroupedExposedFilters();
  $view = Views::getView('test_view');
  $view
    ->setExposedInput(array(
    'status' => 1,
  ));
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')
    ->overrideOption('filters', $filters);
  $this
    ->executeView($view);
  $expected_result = array(
    array(
      'id' => 1,
    ),
    array(
      'id' => 3,
    ),
    array(
      'id' => 5,
    ),
  );
  $this
    ->assertEqual(3, count($view->result));
  $this
    ->assertIdenticalResultset($view, $expected_result, $this->columnMap);
  $view
    ->destroy();
  $view
    ->setExposedInput(array(
    'status' => 2,
  ));
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')
    ->overrideOption('filters', $filters);
  $this
    ->executeView($view);
  $expected_result = array(
    array(
      'id' => 2,
    ),
    array(
      'id' => 4,
    ),
  );
  $this
    ->assertEqual(2, count($view->result));
  $this
    ->assertIdenticalResultset($view, $expected_result, $this->columnMap);
}