function FilterNumericTest::testFilterNumericExposedGroupedRegularExpression

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

Tests the "numeric" filter with grouped exposed filters.

The tests are performed with the 'regular_expression' operator.

File

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

Class

FilterNumericTest
Tests the numeric filter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterNumericExposedGroupedRegularExpression() : void {
  $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.