function AccessAwareRouterTest::setupRouter

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php \Drupal\Tests\Core\Routing\AccessAwareRouterTest::setupRouter()
  2. 10 core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php \Drupal\Tests\Core\Routing\AccessAwareRouterTest::setupRouter()
  3. 11.x 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 63

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

protected function setupRouter() {
    $this->router = $this->getMockBuilder('Drupal\\Core\\Routing\\Router')
        ->disableOriginalConstructor()
        ->getMock();
    $this->router
        ->expects($this->once())
        ->method('matchRequest')
        ->willReturn([
        RouteObjectInterface::ROUTE_OBJECT => $this->route,
    ]);
    $this->accessAwareRouter = new AccessAwareRouter($this->router, $this->accessManager, $this->currentUser);
}

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