You are here

protected function AccessAwareRouterTest::setupRouter in Zircon Profile 8

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

Sets up a chain router with matchRequest.

2 calls to AccessAwareRouterTest::setupRouter()
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 62
Contains \Drupal\Tests\Core\Routing\AccessAwareRouterTest.

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(array(
    RouteObjectInterface::ROUTE_OBJECT => $this->route,
  )));
  $this->router = new AccessAwareRouter($this->chainRouter, $this->accessManager, $this->currentUser);
}