function QueryParameterTest::testGetArgument

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php \Drupal\Tests\views\Unit\Plugin\argument_default\QueryParameterTest::testGetArgument()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/argument_default/QueryParameterTest.php \Drupal\Tests\views\Unit\Plugin\argument_default\QueryParameterTest::testGetArgument()
  3. 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 23

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) : void {
    $view = $this->getMockBuilder('Drupal\\views\\ViewExecutable')
        ->disableOriginalConstructor()
        ->onlyMethods([])
        ->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());
}

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