You are here

protected function AccessAwareRouterTest::setupRouter in Drupal 9

Same name and namespace in other branches
  1. 8 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->router = $this
    ->getMockBuilder('Drupal\\Core\\Routing\\Router')
    ->disableOriginalConstructor()
    ->getMock();
  $this->router
    ->expects($this
    ->once())
    ->method('matchRequest')
    ->will($this
    ->returnValue([
    RouteObjectInterface::ROUTE_OBJECT => $this->route,
  ]));
  $this->accessAwareRouter = new AccessAwareRouter($this->router, $this->accessManager, $this->currentUser);
}