function AdminRouteSubscriberTest::testAlterRoutes

Same name in other branches
  1. 9 core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php \Drupal\Tests\system\Unit\Routing\AdminRouteSubscriberTest::testAlterRoutes()
  2. 8.9.x core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php \Drupal\Tests\system\Unit\Routing\AdminRouteSubscriberTest::testAlterRoutes()
  3. 10 core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php \Drupal\Tests\system\Unit\Routing\AdminRouteSubscriberTest::testAlterRoutes()

@covers ::alterRoutes @covers ::isHtmlRoute

@dataProvider providerTestAlterRoutes

File

core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php, line 25

Class

AdminRouteSubscriberTest
@coversDefaultClass \Drupal\system\EventSubscriber\AdminRouteSubscriber @group system

Namespace

Drupal\Tests\system\Unit\Routing

Code

public function testAlterRoutes(Route $route, $is_admin) : void {
    $collection = new RouteCollection();
    $collection->add('the_route', $route);
    (new AdminRouteSubscriber())->onAlterRoutes(new RouteBuildEvent($collection));
    $this->assertSame($is_admin, $route->getOption('_admin_route'));
}

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