AdminRouteSubscriber example

class AdminRouteSubscriberTest extends UnitTestCase {

  /** * @covers ::alterRoutes * @covers ::isHtmlRoute * * @dataProvider providerTestAlterRoutes */
  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'));
  }

  public function providerTestAlterRoutes() {
    $data = [];
    $data['non-admin'] = [
      new Route('/foo'),
      NULL,
    ];
    $data['admin prefix'] = [
      
Home | Imprint | This part of the site doesn't use cookies.