You are here

public function AdminRouteSubscriberTest::testAlterRoutes in Drupal 8

Same name and namespace in other branches
  1. 9 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 23

Class

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

Namespace

Drupal\Tests\system\Unit\Routing

Code

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