function FilterStringTest::testFilterStringNotRegularExpression
Same name and namespace in other branches
- 10 core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php \Drupal\Tests\views\Kernel\Handler\FilterStringTest::testFilterStringNotRegularExpression()
Tests the string filter handler with the negated 'regular_expression' operator.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterStringTest.php, line 811
Class
- FilterStringTest
- Tests the core <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21StringFilter.php/class/StringFilter/11.x" title="Basic textfield filter to handle string filtering commands." class="local">Drupal\views\Plugin\views\filter\StringFilter</a> handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFilterStringNotRegularExpression() : void {
$view = Views::getView('test_view');
$view->setDisplay();
// Filtering by regular expression pattern.
$view->displayHandlers
->get('default')
->overrideOption('filters', [
'age' => [
'id' => 'name',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
'operator' => 'not_regular_expression',
'value' => [
'value' => '^Rin',
],
],
]);
$this->executeView($view);
$resultset = [
[
'name' => 'John',
'age' => 25,
],
[
'name' => 'George',
'age' => 27,
],
[
'name' => 'Paul',
'age' => 26,
],
[
'name' => 'Meredith',
'age' => 30,
],
];
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.