function FilterCombineTest::testNonFieldsRow
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testNonFieldsRow()
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testNonFieldsRow()
- 10 core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php \Drupal\Tests\views\Kernel\Handler\FilterCombineTest::testNonFieldsRow()
Tests that the "combine" filter is only valid on displays that use fields.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterCombineTest.php, line 312
Class
- FilterCombineTest
- Tests the combine filter handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testNonFieldsRow() : void {
$view = Views::getView('entity_test_fields');
$view->setDisplay();
// Set the rows to a plugin type that doesn't support fields.
$view->displayHandlers
->get('default')
->overrideOption('row', [
'type' => 'entity:entity_test',
'options' => [
'view_mode' => 'teaser',
],
]);
// Change the filtering.
$view->displayHandlers
->get('default')
->overrideOption('filters', [
'name' => [
'id' => 'combine',
'table' => 'views',
'field' => 'combine',
'relationship' => 'none',
'operator' => 'contains',
'fields' => [
'name',
],
'value' => 'ing',
],
]);
$this->executeView($view);
$errors = $view->validate();
// Check that the right error is shown.
$this->assertEquals('Default: Global: Combine fields filter can only be used on displays that use fields. Set the style or row format for that display to one using fields to use the combine field filter.', reset($errors['default']));
// Confirm that the query with single filter does not use the "CONCAT_WS"
// operator.
$this->assertStringNotContainsString('CONCAT_WS(', (string) $view->query
->query());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.