function FilterInOperatorTest::testFilterGroupedChangedIdentifier

Same name and namespace in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterInOperatorTest::testFilterGroupedChangedIdentifier()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterInOperatorTest::testFilterGroupedChangedIdentifier()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterInOperatorTest::testFilterGroupedChangedIdentifier()

Tests that we can safely change the identifier on a grouped filter.

File

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

Class

FilterInOperatorTest
Tests the core <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21InOperator.php/class/InOperator/9" title="Simple filter to handle matching of multiple options selectable via checkboxes." class="local">Drupal\views\Plugin\views\filter\InOperator</a> handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterGroupedChangedIdentifier() {
    $filters = $this->getGroupedExposedFilters();
    $view = Views::getView('test_view');
    $filters['age']['group_info']['default_group'] = 2;
    $filters['age']['group_info']['identifier'] = 'not-age';
    $view->setDisplay();
    $view->displayHandlers
        ->get('default')
        ->overrideOption('filters', $filters);
    $this->executeView($view);
    $expected_result = [
        [
            'name' => 'John',
            'age' => 25,
        ],
        [
            'name' => 'George',
            'age' => 27,
        ],
        [
            'name' => 'Ringo',
            'age' => 28,
        ],
    ];
    $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.