function 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 \Drupal\views\Plugin\views\filter\NumericFilter[[api-linebreak]] @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.