public function AccessAwareRouterTest::testMatchRequestDenied in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php \Drupal\Tests\Core\Routing\AccessAwareRouterTest::testMatchRequestDenied()
Tests the matchRequest() function for access denied.
File
- core/
tests/ Drupal/ Tests/ Core/ Routing/ AccessAwareRouterTest.php, line 91
Class
- AccessAwareRouterTest
- @coversDefaultClass \Drupal\Core\Routing\AccessAwareRouter @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
public function testMatchRequestDenied() {
$this
->setupRouter();
$request = new Request();
$access_result = AccessResult::forbidden();
$this->accessManager
->expects($this
->once())
->method('checkRequest')
->with($request)
->willReturn($access_result);
$this
->expectException(AccessDeniedHttpException::class);
$this->accessAwareRouter
->matchRequest($request);
}