function FilterCombineTest::testFilterCombineNoRealName

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testFilterCombineNoRealName()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testFilterCombineNoRealName()

Tests the combine filter when no realName is used.

File

core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php, line 694

Class

FilterCombineTest
Tests the combine filter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterCombineNoRealName() : void {
    $view = Views::getView('test_view');
    $view->setDisplay();
    $fields = $view->displayHandlers
        ->get('default')
        ->getOption('fields');
    $view->displayHandlers
        ->get('default')
        ->overrideOption('fields', $fields + [
        'name_no_id' => [
            'id' => 'name_no_id',
            'table' => 'views_test_data',
            'field' => 'name_fail',
            'relationship' => 'none',
        ],
    ]);
    // Change the filtering.
    $view->displayHandlers
        ->get('default')
        ->overrideOption('filters', [
        'age' => [
            'id' => 'combine',
            'table' => 'views',
            'field' => 'combine',
            'relationship' => 'none',
            'operator' => 'contains',
            'fields' => [
                'name_no_id',
                'job',
            ],
            'value' => 'iNg',
        ],
    ]);
    $this->executeView($view);
    $resultset = [
        [
            'name' => 'John',
            'job' => 'Singer',
        ],
        [
            'name' => 'George',
            'job' => 'Singer',
        ],
        [
            'name' => 'Ringo',
            'job' => 'Drummer',
        ],
        [
            'name' => 'Ginger',
            'job' => NULL,
        ],
    ];
    $this->assertNotIdenticalResultset($view, $resultset, $this->columnMap);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.