function FilterNumericTest::testFilterNumericBetween

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

Tests the between operator.

@dataProvider providerTestFilterNumericBetween

Parameters

string $operator: The operator to test ('between' or 'not between').

string $min: The min value.

string $max: The max value.

array $expected_result: The expected results.

File

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

Class

FilterNumericTest
Tests the numeric filter handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testFilterNumericBetween($operator, $min, $max, array $expected_result) : void {
    $view = Views::getView('test_view');
    $view->setDisplay();
    $view->displayHandlers
        ->get('default')
        ->overrideOption('filters', [
        'age' => [
            'id' => 'age',
            'table' => 'views_test_data',
            'field' => 'age',
            'relationship' => 'none',
            'operator' => $operator,
            'value' => [
                'min' => $min,
                'max' => $max,
            ],
        ],
    ]);
    $this->executeView($view);
    $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
}

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