public function FilterCombineTest::testFilterCombineContains in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/FilterCombineTest.php \Drupal\views\Tests\Handler\FilterCombineTest::testFilterCombineContains()
File
- core/
modules/ views/ src/ Tests/ Handler/ FilterCombineTest.php, line 37 - Contains \Drupal\views\Tests\Handler\FilterCombineTest.
Class
- FilterCombineTest
- Tests the combine filter handler.
Namespace
Drupal\views\Tests\HandlerCode
public function testFilterCombineContains() {
$view = Views::getView('test_view');
$view
->setDisplay();
$fields = $view->displayHandlers
->get('default')
->getOption('fields');
$view->displayHandlers
->get('default')
->overrideOption('fields', $fields + array(
'job' => array(
'id' => 'job',
'table' => 'views_test_data',
'field' => 'job',
'relationship' => 'none',
),
));
// Change the filtering.
$view->displayHandlers
->get('default')
->overrideOption('filters', array(
'age' => array(
'id' => 'combine',
'table' => 'views',
'field' => 'combine',
'relationship' => 'none',
'operator' => 'contains',
'fields' => array(
'name',
'job',
),
'value' => 'ing',
),
));
$this
->executeView($view);
$resultset = array(
array(
'name' => 'John',
'job' => 'Singer',
),
array(
'name' => 'George',
'job' => 'Singer',
),
array(
'name' => 'Ringo',
'job' => 'Drummer',
),
array(
'name' => 'Ginger',
'job' => NULL,
),
);
$this
->assertIdenticalResultset($view, $resultset, $this->columnMap);
}