From 664217e47128f6619dca29d13098262b6604ccc2 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Sun, 24 Nov 2019 10:45:52 +0100 Subject: [PATCH] use ResponseEvent instead of FilterResponseEvent See https://github.com/symfony/symfony/pull/28920 --- src/EventListener/JsErrorToAlertListener.php | 4 ++-- .../JsErrorToAlertListenerTest.php | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/EventListener/JsErrorToAlertListener.php b/src/EventListener/JsErrorToAlertListener.php index b50fdbe..4f8f640 100644 --- a/src/EventListener/JsErrorToAlertListener.php +++ b/src/EventListener/JsErrorToAlertListener.php @@ -7,13 +7,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; class JsErrorToAlertListener implements EventSubscriberInterface { - public function onKernelResponse(FilterResponseEvent $event): void + public function onKernelResponse(ResponseEvent $event): void { $response = $event->getResponse(); $request = $event->getRequest(); diff --git a/tests/EventListener/JsErrorToAlertListenerTest.php b/tests/EventListener/JsErrorToAlertListenerTest.php index cf1d7d3..7bef8f1 100644 --- a/tests/EventListener/JsErrorToAlertListenerTest.php +++ b/tests/EventListener/JsErrorToAlertListenerTest.php @@ -10,7 +10,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelEvents; @@ -52,7 +52,7 @@ public function testScriptIsInjected(string $responseBody, string $expectedRespo { $response = new Response($responseBody); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, @@ -108,7 +108,7 @@ public function testScriptIsNotInjectedOnRedirection(int $statusCode): void { $response = new Response(self::BASIC_HTML, $statusCode); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, @@ -139,7 +139,7 @@ public function testScriptIsNotInjectedToStreamedResponse(): void { $response = new StreamedResponse(); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, @@ -156,7 +156,7 @@ public function testScriptIsNotInjectedOnSubRequest(): void { $response = new Response(self::BASIC_HTML); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::SUB_REQUEST, @@ -176,7 +176,7 @@ public function testScriptIsNotInjectedOnIncompleteHtmlResponses(): void { $response = new Response('
Some content
'); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, @@ -196,7 +196,7 @@ public function testScriptIsNotInjectedOnXmlHttpRequests(): void { $response = new Response(self::BASIC_HTML); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(true), HttpKernelInterface::MASTER_REQUEST, @@ -216,7 +216,7 @@ public function testScriptIsNotInjectedOnNonHtmlRequests(): void { $response = new Response(self::BASIC_HTML); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(false, 'json'), HttpKernelInterface::MASTER_REQUEST, @@ -237,7 +237,7 @@ public function testScriptIsNotInjectedOnContentDispositionAttachment(): void $response = new Response(self::BASIC_HTML); $response->headers->set('Content-Disposition', 'attachment; filename=test.html'); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, @@ -258,7 +258,7 @@ public function testScriptIsNotInjectedOnNonHtmlContentType(): void $response = new Response(self::BASIC_HTML); $response->headers->set('Content-Type', 'text/xml'); - $event = new FilterResponseEvent( + $event = new ResponseEvent( $this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST,