You are here

protected function AccessAwareRouterTest::setupRouter in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php \Drupal\Tests\Core\Routing\AccessAwareRouterTest::setupRouter()

Sets up a chain router with matchRequest.

3 calls to AccessAwareRouterTest::setupRouter()
AccessAwareRouterTest::testCheckAccessResultWithReason in core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
Tests the matchRequest() function for access denied with reason message.
AccessAwareRouterTest::testMatchRequestAllowed in core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
Tests the matchRequest() function for access allowed.
AccessAwareRouterTest::testMatchRequestDenied in core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
Tests the matchRequest() function for access denied.

File

core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php, line 58

Class

AccessAwareRouterTest
@coversDefaultClass \Drupal\Core\Routing\AccessAwareRouter @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

protected function setupRouter() {
  $this->chainRouter = $this
    ->getMockBuilder('Symfony\\Cmf\\Component\\Routing\\ChainRouter')
    ->disableOriginalConstructor()
    ->getMock();
  $this->chainRouter
    ->expects($this
    ->once())
    ->method('matchRequest')
    ->will($this
    ->returnValue([
    RouteObjectInterface::ROUTE_OBJECT => $this->route,
  ]));
  $this->router = new AccessAwareRouter($this->chainRouter, $this->accessManager, $this->currentUser);
}