You are here

public function QueryParameterTest::testGetArgument in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php \Drupal\Tests\views\Unit\Plugin\argument_default\QueryParameterTest::testGetArgument()
  2. 10 core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php \Drupal\Tests\views\Unit\Plugin\argument_default\QueryParameterTest::testGetArgument()

Tests the getArgument() method.

@covers ::getArgument @dataProvider providerGetArgument

File

core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php, line 21

Class

QueryParameterTest
@coversDefaultClass \Drupal\views\Plugin\views\argument_default\QueryParameter @group views

Namespace

Drupal\Tests\views\Unit\Plugin\argument_default

Code

public function testGetArgument($options, Request $request, $expected) {
  $view = $this
    ->getMockBuilder('Drupal\\views\\ViewExecutable')
    ->disableOriginalConstructor()
    ->setMethods(NULL)
    ->getMock();
  $view
    ->setRequest($request);
  $display_plugin = $this
    ->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
    ->disableOriginalConstructor()
    ->getMock();
  $raw = new QueryParameter([], 'query_parameter', []);
  $raw
    ->init($view, $display_plugin, $options);
  $this
    ->assertEquals($expected, $raw
    ->getArgument());
}