function NumericFilterTest::testAcceptExposedInput

Same name and namespace in other branches
  1. 10 core/modules/views/tests/src/Unit/Plugin/views/filter/NumericFilterTest.php \Drupal\Tests\views\Unit\Plugin\views\filter\NumericFilterTest::testAcceptExposedInput()

Tests the acceptExposedInput method.

@covers ::acceptExposedInput @dataProvider provideAcceptExposedInput

File

core/modules/views/tests/src/Unit/Plugin/views/filter/NumericFilterTest.php, line 24

Class

NumericFilterTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21filter%21NumericFilter.php/class/NumericFilter/11.x" title="Simple filter to handle greater than/less than filters." class="local">\Drupal\views\Plugin\views\filter\NumericFilter</a> @group Views

Namespace

Drupal\Tests\views\Unit\Plugin\views\filter

Code

public function testAcceptExposedInput($options, $value, $expected) : void {
    $plugin_definition = [
        'title' => $this->randomMachineName(),
    ];
    $plugin = new NumericFilter([], 'numeric', $plugin_definition);
    $translation_stub = $this->getStringTranslationStub();
    $plugin->setStringTranslation($translation_stub);
    $view = $this->prophesize(ViewExecutable::class)
        ->reveal();
    $display = $this->prophesize(DisplayPluginBase::class)
        ->reveal();
    $view->display_handler = $display;
    $plugin->init($view, $view->display_handler, $options);
    $this->assertSame($expected, $plugin->acceptExposedInput($value));
}

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