public function AccessManagerTest::testCheckNamedRouteWithNonExistingRoute in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php \Drupal\Tests\Core\Access\AccessManagerTest::testCheckNamedRouteWithNonExistingRoute()
Tests checkNamedRoute given an invalid/non existing route name.
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php, line 460 - Contains \Drupal\Tests\Core\Access\AccessManagerTest.
Class
- AccessManagerTest
- @coversDefaultClass \Drupal\Core\Access\AccessManager @group Access
Namespace
Drupal\Tests\Core\AccessCode
public function testCheckNamedRouteWithNonExistingRoute() {
$this->routeProvider
->expects($this
->any())
->method('getRouteByName')
->will($this
->throwException(new RouteNotFoundException()));
$this
->setupAccessChecker();
$this
->assertEquals(FALSE, $this->accessManager
->checkNamedRoute('test_route_1', [], $this->account), 'A non existing route lead to access.');
$this
->assertEquals(AccessResult::forbidden()
->addCacheTags([
'config:core.extension',
]), $this->accessManager
->checkNamedRoute('test_route_1', [], $this->account, TRUE), 'A non existing route lead to access.');
}