1212namespace Symfony \Component \Security \Tests \Http \Firewall ;
1313
1414use PHPUnit \Framework \TestCase ;
15+ use Symfony \Component \HttpFoundation \RedirectResponse ;
1516use Symfony \Component \HttpFoundation \Request ;
1617use Symfony \Component \HttpFoundation \Response ;
1718use Symfony \Component \HttpKernel \Event \GetResponseEvent ;
@@ -40,6 +41,10 @@ public function testHandleWhenUsernameLength($username, $ok)
4041 ->method ('checkRequestPath ' )
4142 ->willReturn (true )
4243 ;
44+ $ httpUtils
45+ ->method ('createRedirectResponse ' )
46+ ->willReturn (new RedirectResponse ('/hello ' ))
47+ ;
4348
4449 $ failureHandler = $ this ->getMockBuilder ('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface ' )->getMock ();
4550 $ failureHandler
@@ -52,7 +57,7 @@ public function testHandleWhenUsernameLength($username, $ok)
5257 $ authenticationManager
5358 ->expects ($ ok ? $ this ->once () : $ this ->never ())
5459 ->method ('authenticate ' )
55- ->willReturn ( new Response () )
60+ ->willReturnArgument ( 0 )
5661 ;
5762
5863 $ listener = new UsernamePasswordFormAuthenticationListener (
@@ -61,7 +66,7 @@ public function testHandleWhenUsernameLength($username, $ok)
6166 $ this ->getMockBuilder ('Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface ' )->getMock (),
6267 $ httpUtils ,
6368 'TheProviderKey ' ,
64- $ this -> getMockBuilder ( ' Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface ' )-> getMock ( ),
69+ new DefaultAuthenticationSuccessHandler ( $ httpUtils ),
6570 $ failureHandler ,
6671 ['require_previous_session ' => false ]
6772 );
0 commit comments