function PagerManagerTest::testFindPage

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php \Drupal\KernelTests\Core\Pager\PagerManagerTest::testFindPage()
  2. 10 core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php \Drupal\KernelTests\Core\Pager\PagerManagerTest::testFindPage()

@covers ::findPage

File

core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php, line 49

Class

PagerManagerTest
@group Pager

Namespace

Drupal\KernelTests\Core\Pager

Code

public function testFindPage() : void {
    $request = Request::create('http://example.com', 'GET', [
        'page' => '0,10',
    ]);
    $request->setSession(new Session(new MockArraySessionStorage()));
    
    /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */
    $request_stack = $this->container
        ->get('request_stack');
    $request_stack->push($request);
    $pager_manager = $this->container
        ->get('pager.manager');
    $this->assertEquals(10, $pager_manager->findPage(1));
}

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