diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/EventSubscriber/FormTestEventSubscriber.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/EventSubscriber/FormTestEventSubscriber.php index 11e5a7a..444f7d7 100644 --- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/EventSubscriber/FormTestEventSubscriber.php +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/EventSubscriber/FormTestEventSubscriber.php @@ -7,18 +7,18 @@ namespace Drupal\form_test\EventSubscriber; -use Drupal\Core\Routing\RouteBuildEvent; +use Drupal\Core\Routing\RouteSubscriberBase; use Drupal\Core\Routing\RoutingEvents; use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\Routing\Route; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Routing\RouteCollection; /** * Test event subscriber to add new attributes to the request. */ -class FormTestEventSubscriber implements EventSubscriberInterface { +class FormTestEventSubscriber extends RouteSubscriberBase { /** * The module handler. @@ -51,18 +51,15 @@ public function onKernelRequest(GetResponseEvent $event) { */ public static function getSubscribedEvents() { $events[KernelEvents::REQUEST][] = array('onKernelRequest'); - $events[RoutingEvents::DYNAMIC] = 'routes'; - + $events[RoutingEvents::DYNAMIC] = 'onDynamicRoutes'; + $events[RoutingEvents::ALTER] = 'onAlterRoutes'; return $events; } /** * Adds routes for the Form Tests. */ - public function routes(RouteBuildEvent $event) { - $collection = $event->getRouteCollection(); - $defaults = array(); - + protected function routes(RouteCollection $collection) { if ($this->moduleHandler->moduleExists('node')) { $route = new Route( "form-test/two-instances-of-same-form",