You are here

public function RequestPagerTest::testGetQueryParameters in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php \Drupal\KernelTests\Core\Pager\RequestPagerTest::testGetQueryParameters()

@covers ::getQueryParameters

File

core/tests/Drupal/KernelTests/Core/Pager/RequestPagerTest.php, line 33

Class

RequestPagerTest
@group Pager

Namespace

Drupal\KernelTests\Core\Pager

Code

public function testGetQueryParameters() {
  $test_parameters = [
    'other' => 'arbitrary',
  ];
  $request = Request::create('http://example.com', 'GET', array_merge([
    'page' => '0,10',
  ], $test_parameters));

  /* @var $request_stack \Symfony\Component\HttpFoundation\RequestStack */
  $request_stack = $this->container
    ->get('request_stack');
  $request_stack
    ->push($request);
  $pager_params = $this->container
    ->get('pager.parameters');
  $this
    ->assertEquals($test_parameters, $pager_params
    ->getQueryParameters());
  $this
    ->assertEquals(0, $pager_params
    ->findPage());
}