diff --git a/src/EventSubscriber/RouteNameResponseSubscriber.php b/src/EventSubscriber/RouteNameResponseSubscriber.php index 7adf876..4cb96e2 100644 --- a/src/EventSubscriber/RouteNameResponseSubscriber.php +++ b/src/EventSubscriber/RouteNameResponseSubscriber.php @@ -41,7 +41,7 @@ public function __construct(RouteMatchInterface $route_match) { * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event * The event to process. */ - public function onRespond(FilterResponseEvent $event) { + public function onResponse(FilterResponseEvent $event) { $response = $event->getResponse(); if ($response instanceof CacheableResponseInterface) { $cacheability_metadata = $response->getCacheableMetadata(); @@ -53,8 +53,8 @@ public function onRespond(FilterResponseEvent $event) { * {@inheritdoc} */ public static function getSubscribedEvents() { - // Run before finish_response_subscriber:onRespond. - $events[KernelEvents::RESPONSE][] = ['onRespond', 1]; + // Run before dynamic_page_cache_subscriber:onResponse. + $events[KernelEvents::RESPONSE][] = ['onResponse', 101]; return $events; } diff --git a/tests/src/Unit/RouteNameResponseSubscriberTest.php b/tests/src/Unit/RouteNameResponseSubscriberTest.php index 593de44..663a99a 100644 --- a/tests/src/Unit/RouteNameResponseSubscriberTest.php +++ b/tests/src/Unit/RouteNameResponseSubscriberTest.php @@ -23,9 +23,9 @@ class RouteNameResponseSubscriberTest extends UnitTestCase { /** - * @covers ::onRespond + * @covers ::onResponse */ - public function testOnRespondCacheable() { + public function testOnResponseCacheable() { $response = new CacheableResponse(''); $event = $this->buildEvent($response); @@ -34,16 +34,16 @@ public function testOnRespondCacheable() { $route_match->getRouteName()->willReturn($route_name); $subscriber = new RouteNameResponseSubscriber($route_match->reveal()); - $subscriber->onRespond($event); + $subscriber->onResponse($event); $expected = ["route_name:$route_name"]; $this->assertSame($expected, $response->getCacheableMetadata()->getCacheTags()); } /** - * @covers ::onRespond + * @covers ::onResponse */ - public function testOnRespondUncacheable() { + public function testOnResponseUncacheable() { $response = new Response(''); $event = $this->buildEvent($response); @@ -51,7 +51,7 @@ public function testOnRespondUncacheable() { $route_match->getRouteName()->shouldNotBeCalled(); $subscriber = new RouteNameResponseSubscriber($route_match->reveal()); - $subscriber->onRespond($event); + $subscriber->onResponse($event); } protected function buildEvent(Response $response) {