You are here

public function FilterNumericTest::testFilterNumericSimple 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::testFilterNumericSimple()

File

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

Class

FilterNumericTest
Tests the numeric filter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterNumericSimple() {
  $view = Views::getView('test_view');
  $view
    ->setDisplay();

  // Change the filtering
  $view->displayHandlers
    ->get('default')
    ->overrideOption('filters', [
    'age' => [
      'id' => 'age',
      'table' => 'views_test_data',
      'field' => 'age',
      'relationship' => 'none',
      'operator' => '=',
      'value' => [
        'value' => 28,
      ],
    ],
  ]);
  $this
    ->executeView($view);
  $resultset = [
    [
      'name' => 'Ringo',
      'age' => 28,
    ],
  ];
  $this
    ->assertIdenticalResultset($view, $resultset, $this->columnMap);
}