You are here

public function FilterInOperatorTest::testFilterInOperatorGroupedExposedSimple in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterInOperatorTest::testFilterInOperatorGroupedExposedSimple()

File

core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php, line 111

Class

FilterInOperatorTest
Tests the core Drupal\views\Plugin\views\filter\InOperator handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterInOperatorGroupedExposedSimple() {
  $filters = $this
    ->getGroupedExposedFilters();
  $view = Views::getView('test_view');

  // Filter: Age, Operator: in, Value: 26, 30
  $filters['age']['group_info']['default_group'] = 1;
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')
    ->overrideOption('filters', $filters);
  $this
    ->executeView($view);
  $expected_result = [
    [
      'name' => 'Paul',
      'age' => 26,
    ],
    [
      'name' => 'Meredith',
      'age' => 30,
    ],
  ];
  $this
    ->assertCount(2, $view->result);
  $this
    ->assertIdenticalResultset($view, $expected_result, $this->columnMap);
}