You are here

public function FilterNumericTest::testFilterNumericExposedGroupedRegularExpression in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testFilterNumericExposedGroupedRegularExpression()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php \Drupal\Tests\views\Kernel\Handler\FilterNumericTest::testFilterNumericExposedGroupedRegularExpression()

Tests the numeric filter handler with the 'regular_expression' operator to grouped exposed filters.

File

core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php, line 281

Class

FilterNumericTest
Tests the numeric filter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterNumericExposedGroupedRegularExpression() {
  $filters = $this
    ->getGroupedExposedFilters();
  $view = Views::getView('test_view');
  $view
    ->newDisplay('page', 'Page', 'page_1');

  // Filter: Age, Operator: regular_expression, Value: 2[7-8]
  $filters['age']['group_info']['default_group'] = 6;
  $view
    ->setDisplay('page_1');
  $view->displayHandlers
    ->get('page_1')
    ->overrideOption('filters', $filters);
  $view
    ->save();
  $this
    ->executeView($view);
  $resultset = [
    [
      'name' => 'George',
      'age' => 27,
    ],
    [
      'name' => 'Ringo',
      'age' => 28,
    ],
  ];
  $this
    ->assertIdenticalResultset($view, $resultset, $this->columnMap);
}