1515use Symfony \Component \HttpFoundation \Request ;
1616use Symfony \Component \HttpFoundation \Response ;
1717use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
18- use Symfony \Component \HttpKernel \Event \GetResponseForExceptionEvent ;
1918use Symfony \Component \HttpKernel \Exception \HttpException ;
2019use Symfony \Component \HttpKernel \HttpKernelInterface ;
2120use Symfony \Component \Security \Core \Authentication \AuthenticationTrustResolverInterface ;
@@ -40,7 +39,7 @@ public function testAuthenticationExceptionWithoutEntryPoint(\Exception $excepti
4039 $ listener ->onKernelException ($ event );
4140
4241 $ this ->assertNull ($ event ->getResponse ());
43- $ this ->assertEquals ($ eventException , $ event ->getException ());
42+ $ this ->assertEquals ($ eventException , $ event ->getThrowable ());
4443 }
4544
4645 /**
@@ -59,7 +58,7 @@ public function testAuthenticationExceptionWithEntryPoint(\Exception $exception)
5958
6059 $ this ->assertEquals ('Forbidden ' , $ event ->getResponse ()->getContent ());
6160 $ this ->assertEquals (403 , $ event ->getResponse ()->getStatusCode ());
62- $ this ->assertSame ($ exception , $ event ->getException ());
61+ $ this ->assertSame ($ exception , $ event ->getThrowable ());
6362 }
6463
6564 public function getAuthenticationExceptionProvider ()
@@ -86,8 +85,8 @@ public function testExceptionWhenEntryPointReturnsBadValue()
8685 $ listener = $ this ->createExceptionListener (null , null , null , $ entryPoint );
8786 $ listener ->onKernelException ($ event );
8887 // the exception has been replaced by our LogicException
89- $ this ->assertInstanceOf ('LogicException ' , $ event ->getException ());
90- $ this ->assertStringEndsWith ('start() method must return a Response object (string returned) ' , $ event ->getException ()->getMessage ());
88+ $ this ->assertInstanceOf ('LogicException ' , $ event ->getThrowable ());
89+ $ this ->assertStringEndsWith ('start() method must return a Response object (string returned) ' , $ event ->getThrowable ()->getMessage ());
9190 }
9291
9392 /**
@@ -101,7 +100,7 @@ public function testAccessDeniedExceptionFullFledgedAndWithoutAccessDeniedHandle
101100 $ listener ->onKernelException ($ event );
102101
103102 $ this ->assertNull ($ event ->getResponse ());
104- $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getException ()->getPrevious ());
103+ $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getThrowable ()->getPrevious ());
105104 }
106105
107106 /**
@@ -124,7 +123,7 @@ public function testAccessDeniedExceptionFullFledgedAndWithoutAccessDeniedHandle
124123
125124 $ this ->assertEquals ('Unauthorized ' , $ event ->getResponse ()->getContent ());
126125 $ this ->assertEquals (401 , $ event ->getResponse ()->getStatusCode ());
127- $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getException ()->getPrevious ());
126+ $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getThrowable ()->getPrevious ());
128127 }
129128
130129 /**
@@ -141,7 +140,7 @@ public function testAccessDeniedExceptionFullFledgedAndWithAccessDeniedHandlerAn
141140 $ listener ->onKernelException ($ event );
142141
143142 $ this ->assertEquals ('error ' , $ event ->getResponse ()->getContent ());
144- $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getException ()->getPrevious ());
143+ $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getThrowable ()->getPrevious ());
145144 }
146145
147146 /**
@@ -158,7 +157,7 @@ public function testAccessDeniedExceptionNotFullFledged(\Exception $exception, \
158157 $ listener ->onKernelException ($ event );
159158
160159 $ this ->assertEquals ('OK ' , $ event ->getResponse ()->getContent ());
161- $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getException ()->getPrevious ());
160+ $ this ->assertSame (null === $ eventException ? $ exception : $ eventException , $ event ->getThrowable ()->getPrevious ());
162161 }
163162
164163 public function getAccessDeniedExceptionProvider ()
@@ -194,11 +193,7 @@ private function createEvent(\Exception $exception, $kernel = null)
194193 $ kernel = $ this ->getMockBuilder ('Symfony\Component\HttpKernel\HttpKernelInterface ' )->getMock ();
195194 }
196195
197- if (class_exists (ExceptionEvent::class)) {
198- return new ExceptionEvent ($ kernel , Request::create ('/ ' ), HttpKernelInterface::MASTER_REQUEST , $ exception );
199- }
200-
201- return new GetResponseForExceptionEvent ($ kernel , Request::create ('/ ' ), HttpKernelInterface::MASTER_REQUEST , $ exception );
196+ return new ExceptionEvent ($ kernel , Request::create ('/ ' ), HttpKernelInterface::MASTER_REQUEST , $ exception );
202197 }
203198
204199 private function createExceptionListener (TokenStorageInterface $ tokenStorage = null , AuthenticationTrustResolverInterface $ trustResolver = null , HttpUtils $ httpUtils = null , AuthenticationEntryPointInterface $ authenticationEntryPoint = null , $ errorPage = null , AccessDeniedHandlerInterface $ accessDeniedHandler = null )
0 commit comments