function FilterNumericTest::testFilterNumericRegularExpression
Same name in other branches
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testFilterNumericRegularExpression()
- 10 core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testFilterNumericRegularExpression()
- 11.x core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testFilterNumericRegularExpression()
Tests the numeric filter handler with the 'regular_expression' operator.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FilterNumericTest.php, line 249
Class
- FilterNumericTest
- Tests the numeric filter handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFilterNumericRegularExpression() {
$view = Views::getView('test_view');
$view->setDisplay();
// Filtering by regular expression pattern.
$view->displayHandlers
->get('default')
->overrideOption('filters', [
'age' => [
'id' => 'age',
'table' => 'views_test_data',
'field' => 'age',
'relationship' => 'none',
'operator' => 'regular_expression',
'value' => [
'value' => '2[8]',
],
],
]);
$this->executeView($view);
$resultset = [
[
'name' => 'Ringo',
'age' => 28,
],
];
$this->assertIdenticalResultset($view, $resultset, $this->columnMap);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.