function FilterBooleanOperatorTest::testFilterGroupedExposed
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::testFilterGroupedExposed()
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::testFilterGroupedExposed()
- 11.x core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::testFilterGroupedExposed()
Tests the boolean filter with grouped exposed form enabled.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterBooleanOperatorTest.php, line 116
Class
- FilterBooleanOperatorTest
- Tests the core Drupal\views\Plugin\views\filter\BooleanOperator handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFilterGroupedExposed() : void {
$filters = $this->getGroupedExposedFilters();
$view = Views::getView('test_view');
$view->setExposedInput([
'status' => 1,
]);
$view->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('filters', $filters);
$this->executeView($view);
$expected_result = [
[
'id' => 1,
],
[
'id' => 3,
],
[
'id' => 5,
],
];
$this->assertCount(3, $view->result);
$this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
$view->destroy();
$view->setExposedInput([
'status' => 2,
]);
$view->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('filters', $filters);
$this->executeView($view);
$expected_result = [
[
'id' => 2,
],
[
'id' => 4,
],
];
$this->assertCount(2, $view->result);
$this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
$view->destroy();
// Expecting the same results as for ['status' => 1].
$view->setExposedInput([
'status' => 3,
]);
$view->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('filters', $filters);
$this->executeView($view);
$expected_result = [
[
'id' => 1,
],
[
'id' => 3,
],
[
'id' => 5,
],
];
$this->assertCount(3, $view->result);
$this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.