function FilterCombineTest::testFilterCombineAllWords
Same name in other branches
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testFilterCombineAllWords()
- 10 core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testFilterCombineAllWords()
- 11.x core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testFilterCombineAllWords()
Tests the Combine field filter with the 'allwords' operator.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterCombineTest.php, line 154
Class
- FilterCombineTest
- Tests the combine filter handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFilterCombineAllWords() {
$view = Views::getView('test_view');
$view->setDisplay();
$fields = $view->displayHandlers
->get('default')
->getOption('fields');
$view->displayHandlers
->get('default')
->overrideOption('fields', $fields + [
'job' => [
'id' => 'job',
'table' => 'views_test_data',
'field' => 'job',
'relationship' => 'none',
],
]);
// Set the filtering to allwords and simulate searching for a phrase.
$view->displayHandlers
->get('default')
->overrideOption('filters', [
'age' => [
'id' => 'combine',
'table' => 'views',
'field' => 'combine',
'relationship' => 'none',
'operator' => 'allwords',
'fields' => [
'name',
'job',
'age',
],
'value' => '25 "john singer"',
],
]);
$this->executeView($view);
$resultset = [
[
'name' => 'John',
'job' => 'Singer',
],
];
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
// Confirm that the query with multiple filters used the "CONCAT_WS"
// operator.
$this->assertStringContainsString('CONCAT_WS(', $view->query
->query());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.