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.

Attributes

#[DataProvider('provideAcceptExposedInput')]

File

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

Class

NumericFilterTest
Tests Drupal\views\Plugin\views\filter\NumericFilter.

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.