@@ -33,9 +33,9 @@ class UsernamePasswordFormAuthenticationListenerTest extends TestCase
33
33
public function testHandleWhenUsernameLength ($ username , $ ok )
34
34
{
35
35
$ request = Request::create ('/login_check ' , 'POST ' , ['_username ' => $ username ]);
36
- $ request ->setSession ($ this ->getMockBuilder (' Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
36
+ $ request ->setSession ($ this ->getMockBuilder (\ Symfony \Component \HttpFoundation \Session \SessionInterface::class )->getMock ());
37
37
38
- $ httpUtils = $ this ->getMockBuilder (' Symfony\Component\Security\Http\ HttpUtils' )->getMock ();
38
+ $ httpUtils = $ this ->getMockBuilder (HttpUtils::class )->getMock ();
39
39
$ httpUtils
40
40
->expects ($ this ->any ())
41
41
->method ('checkRequestPath ' )
@@ -46,24 +46,24 @@ public function testHandleWhenUsernameLength($username, $ok)
46
46
->willReturn (new RedirectResponse ('/hello ' ))
47
47
;
48
48
49
- $ failureHandler = $ this ->getMockBuilder (' Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface ' )->getMock ();
49
+ $ failureHandler = $ this ->getMockBuilder (\ Symfony \Component \Security \Http \Authentication \AuthenticationFailureHandlerInterface::class )->getMock ();
50
50
$ failureHandler
51
51
->expects ($ ok ? $ this ->never () : $ this ->once ())
52
52
->method ('onAuthenticationFailure ' )
53
53
->willReturn (new Response ())
54
54
;
55
55
56
- $ authenticationManager = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager ' )->disableOriginalConstructor ()->getMock ();
56
+ $ authenticationManager = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \AuthenticationProviderManager::class )->disableOriginalConstructor ()->getMock ();
57
57
$ authenticationManager
58
58
->expects ($ ok ? $ this ->once () : $ this ->never ())
59
59
->method ('authenticate ' )
60
60
->willReturnArgument (0 )
61
61
;
62
62
63
63
$ listener = new UsernamePasswordFormAuthenticationListener (
64
- $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )->getMock (),
64
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface::class )->getMock (),
65
65
$ authenticationManager ,
66
- $ this ->getMockBuilder (' Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface ' )->getMock (),
66
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Http \Session \SessionAuthenticationStrategyInterface::class )->getMock (),
67
67
$ httpUtils ,
68
68
'TheProviderKey ' ,
69
69
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
@@ -86,18 +86,18 @@ public function testHandleWhenUsernameLength($username, $ok)
86
86
*/
87
87
public function testHandleNonStringUsernameWithArray ($ postOnly )
88
88
{
89
- $ this ->expectException (' Symfony\Component\HttpKernel\Exception\BadRequestHttpException ' );
89
+ $ this ->expectException (\ Symfony \Component \HttpKernel \Exception \BadRequestHttpException::class );
90
90
$ this ->expectExceptionMessage ('The key "_username" must be a string, "array" given. ' );
91
91
$ request = Request::create ('/login_check ' , 'POST ' , ['_username ' => []]);
92
- $ request ->setSession ($ this ->getMockBuilder (' Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
92
+ $ request ->setSession ($ this ->getMockBuilder (\ Symfony \Component \HttpFoundation \Session \SessionInterface::class )->getMock ());
93
93
$ listener = new UsernamePasswordFormAuthenticationListener (
94
94
new TokenStorage (),
95
- $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )->getMock (),
95
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \AuthenticationManagerInterface::class )->getMock (),
96
96
new SessionAuthenticationStrategy (SessionAuthenticationStrategy::NONE ),
97
97
$ httpUtils = new HttpUtils (),
98
98
'foo ' ,
99
99
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
100
- new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (' Symfony\Component\HttpKernel\ HttpKernelInterface' )->getMock (), $ httpUtils ),
100
+ new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (HttpKernelInterface::class )->getMock (), $ httpUtils ),
101
101
['require_previous_session ' => false , 'post_only ' => $ postOnly ]
102
102
);
103
103
$ event = new RequestEvent ($ this ->getMockBuilder (HttpKernelInterface::class)->getMock (), $ request , HttpKernelInterface::MASTER_REQUEST );
@@ -109,18 +109,18 @@ public function testHandleNonStringUsernameWithArray($postOnly)
109
109
*/
110
110
public function testHandleNonStringUsernameWithInt ($ postOnly )
111
111
{
112
- $ this ->expectException (' Symfony\Component\HttpKernel\Exception\BadRequestHttpException ' );
112
+ $ this ->expectException (\ Symfony \Component \HttpKernel \Exception \BadRequestHttpException::class );
113
113
$ this ->expectExceptionMessage ('The key "_username" must be a string, "int" given. ' );
114
114
$ request = Request::create ('/login_check ' , 'POST ' , ['_username ' => 42 ]);
115
- $ request ->setSession ($ this ->getMockBuilder (' Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
115
+ $ request ->setSession ($ this ->getMockBuilder (\ Symfony \Component \HttpFoundation \Session \SessionInterface::class )->getMock ());
116
116
$ listener = new UsernamePasswordFormAuthenticationListener (
117
117
new TokenStorage (),
118
- $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )->getMock (),
118
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \AuthenticationManagerInterface::class )->getMock (),
119
119
new SessionAuthenticationStrategy (SessionAuthenticationStrategy::NONE ),
120
120
$ httpUtils = new HttpUtils (),
121
121
'foo ' ,
122
122
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
123
- new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (' Symfony\Component\HttpKernel\ HttpKernelInterface' )->getMock (), $ httpUtils ),
123
+ new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (HttpKernelInterface::class )->getMock (), $ httpUtils ),
124
124
['require_previous_session ' => false , 'post_only ' => $ postOnly ]
125
125
);
126
126
$ event = new RequestEvent ($ this ->getMockBuilder (HttpKernelInterface::class)->getMock (), $ request , HttpKernelInterface::MASTER_REQUEST );
@@ -132,18 +132,18 @@ public function testHandleNonStringUsernameWithInt($postOnly)
132
132
*/
133
133
public function testHandleNonStringUsernameWithObject ($ postOnly )
134
134
{
135
- $ this ->expectException (' Symfony\Component\HttpKernel\Exception\BadRequestHttpException ' );
135
+ $ this ->expectException (\ Symfony \Component \HttpKernel \Exception \BadRequestHttpException::class );
136
136
$ this ->expectExceptionMessage ('The key "_username" must be a string, "stdClass" given. ' );
137
137
$ request = Request::create ('/login_check ' , 'POST ' , ['_username ' => new \stdClass ()]);
138
- $ request ->setSession ($ this ->getMockBuilder (' Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
138
+ $ request ->setSession ($ this ->getMockBuilder (\ Symfony \Component \HttpFoundation \Session \SessionInterface::class )->getMock ());
139
139
$ listener = new UsernamePasswordFormAuthenticationListener (
140
140
new TokenStorage (),
141
- $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )->getMock (),
141
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \AuthenticationManagerInterface::class )->getMock (),
142
142
new SessionAuthenticationStrategy (SessionAuthenticationStrategy::NONE ),
143
143
$ httpUtils = new HttpUtils (),
144
144
'foo ' ,
145
145
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
146
- new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (' Symfony\Component\HttpKernel\ HttpKernelInterface' )->getMock (), $ httpUtils ),
146
+ new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (HttpKernelInterface::class )->getMock (), $ httpUtils ),
147
147
['require_previous_session ' => false , 'post_only ' => $ postOnly ]
148
148
);
149
149
$ event = new RequestEvent ($ this ->getMockBuilder (HttpKernelInterface::class)->getMock (), $ request , HttpKernelInterface::MASTER_REQUEST );
@@ -162,15 +162,15 @@ public function testHandleNonStringUsernameWith__toString($postOnly)
162
162
->willReturn ('someUsername ' );
163
163
164
164
$ request = Request::create ('/login_check ' , 'POST ' , ['_username ' => $ usernameClass ]);
165
- $ request ->setSession ($ this ->getMockBuilder (' Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
165
+ $ request ->setSession ($ this ->getMockBuilder (\ Symfony \Component \HttpFoundation \Session \SessionInterface::class )->getMock ());
166
166
$ listener = new UsernamePasswordFormAuthenticationListener (
167
167
new TokenStorage (),
168
- $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )->getMock (),
168
+ $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \AuthenticationManagerInterface::class )->getMock (),
169
169
new SessionAuthenticationStrategy (SessionAuthenticationStrategy::NONE ),
170
170
$ httpUtils = new HttpUtils (),
171
171
'foo ' ,
172
172
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
173
- new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (' Symfony\Component\HttpKernel\ HttpKernelInterface' )->getMock (), $ httpUtils ),
173
+ new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder (HttpKernelInterface::class )->getMock (), $ httpUtils ),
174
174
['require_previous_session ' => false , 'post_only ' => $ postOnly ]
175
175
);
176
176
$ event = new RequestEvent ($ this ->getMockBuilder (HttpKernelInterface::class)->getMock (), $ request , HttpKernelInterface::MASTER_REQUEST );
0 commit comments