@@ -25,7 +25,7 @@ class DaoAuthenticationProviderTest extends TestCase
25
25
{
26
26
public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface ()
27
27
{
28
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationServiceException ' );
28
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationServiceException::class );
29
29
$ provider = $ this ->getProvider ('fabien ' );
30
30
$ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
31
31
$ method ->setAccessible (true );
@@ -35,14 +35,14 @@ public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
35
35
36
36
public function testRetrieveUserWhenUsernameIsNotFound ()
37
37
{
38
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\ UsernameNotFoundException' );
39
- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
38
+ $ this ->expectException (UsernameNotFoundException::class );
39
+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
40
40
$ userProvider ->expects ($ this ->once ())
41
41
->method ('loadUserByUsername ' )
42
42
->willThrowException (new UsernameNotFoundException ())
43
43
;
44
44
45
- $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserCheckerInterface ' )->getMock (), 'key ' , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ());
45
+ $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock (), 'key ' , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ());
46
46
$ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
47
47
$ method ->setAccessible (true );
48
48
@@ -51,14 +51,14 @@ public function testRetrieveUserWhenUsernameIsNotFound()
51
51
52
52
public function testRetrieveUserWhenAnExceptionOccurs ()
53
53
{
54
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationServiceException ' );
55
- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
54
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationServiceException::class );
55
+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
56
56
$ userProvider ->expects ($ this ->once ())
57
57
->method ('loadUserByUsername ' )
58
58
->willThrowException (new \RuntimeException ())
59
59
;
60
60
61
- $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserCheckerInterface ' )->getMock (), 'key ' , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ());
61
+ $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock (), 'key ' , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ());
62
62
$ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
63
63
$ method ->setAccessible (true );
64
64
@@ -67,7 +67,7 @@ public function testRetrieveUserWhenAnExceptionOccurs()
67
67
68
68
public function testRetrieveUserReturnsUserFromTokenOnReauthentication ()
69
69
{
70
- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
70
+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
71
71
$ userProvider ->expects ($ this ->never ())
72
72
->method ('loadUserByUsername ' )
73
73
;
@@ -79,7 +79,7 @@ public function testRetrieveUserReturnsUserFromTokenOnReauthentication()
79
79
->willReturn ($ user )
80
80
;
81
81
82
- $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserCheckerInterface ' )->getMock (), 'key ' , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ());
82
+ $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock (), 'key ' , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ());
83
83
$ reflection = new \ReflectionMethod ($ provider , 'retrieveUser ' );
84
84
$ reflection ->setAccessible (true );
85
85
$ result = $ reflection ->invoke ($ provider , 'someUser ' , $ token );
@@ -91,13 +91,13 @@ public function testRetrieveUser()
91
91
{
92
92
$ user = new TestUser ();
93
93
94
- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
94
+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
95
95
$ userProvider ->expects ($ this ->once ())
96
96
->method ('loadUserByUsername ' )
97
97
->willReturn ($ user )
98
98
;
99
99
100
- $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserCheckerInterface ' )->getMock (), 'key ' , $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ());
100
+ $ provider = new DaoAuthenticationProvider ($ userProvider , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock (), 'key ' , $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ());
101
101
$ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
102
102
$ method ->setAccessible (true );
103
103
@@ -106,8 +106,8 @@ public function testRetrieveUser()
106
106
107
107
public function testCheckAuthenticationWhenCredentialsAreEmpty ()
108
108
{
109
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\BadCredentialsException ' );
110
- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
109
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \BadCredentialsException::class );
110
+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
111
111
$ encoder
112
112
->expects ($ this ->never ())
113
113
->method ('isPasswordValid ' )
@@ -129,7 +129,7 @@ public function testCheckAuthenticationWhenCredentialsAreEmpty()
129
129
130
130
public function testCheckAuthenticationWhenCredentialsAre0 ()
131
131
{
132
- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
132
+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
133
133
$ encoder
134
134
->expects ($ this ->once ())
135
135
->method ('isPasswordValid ' )
@@ -156,8 +156,8 @@ public function testCheckAuthenticationWhenCredentialsAre0()
156
156
157
157
public function testCheckAuthenticationWhenCredentialsAreNotValid ()
158
158
{
159
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\BadCredentialsException ' );
160
- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
159
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \BadCredentialsException::class );
160
+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
161
161
$ encoder ->expects ($ this ->once ())
162
162
->method ('isPasswordValid ' )
163
163
->willReturn (false )
@@ -178,8 +178,8 @@ public function testCheckAuthenticationWhenCredentialsAreNotValid()
178
178
179
179
public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChanged ()
180
180
{
181
- $ this ->expectException (' Symfony\Component\Security\Core\Exception\BadCredentialsException ' );
182
- $ user = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
181
+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \BadCredentialsException::class );
182
+ $ user = $ this ->getMockBuilder (UserInterface::class )->getMock ();
183
183
$ user ->expects ($ this ->once ())
184
184
->method ('getPassword ' )
185
185
->willReturn ('foo ' )
@@ -190,7 +190,7 @@ public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChang
190
190
->method ('getUser ' )
191
191
->willReturn ($ user );
192
192
193
- $ dbUser = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
193
+ $ dbUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
194
194
$ dbUser ->expects ($ this ->once ())
195
195
->method ('getPassword ' )
196
196
->willReturn ('newFoo ' )
@@ -204,7 +204,7 @@ public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChang
204
204
205
205
public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithoutOriginalCredentials ()
206
206
{
207
- $ user = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
207
+ $ user = $ this ->getMockBuilder (UserInterface::class )->getMock ();
208
208
$ user ->expects ($ this ->once ())
209
209
->method ('getPassword ' )
210
210
->willReturn ('foo ' )
@@ -215,7 +215,7 @@ public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithou
215
215
->method ('getUser ' )
216
216
->willReturn ($ user );
217
217
218
- $ dbUser = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
218
+ $ dbUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
219
219
$ dbUser ->expects ($ this ->once ())
220
220
->method ('getPassword ' )
221
221
->willReturn ('foo ' )
@@ -229,7 +229,7 @@ public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithou
229
229
230
230
public function testCheckAuthentication ()
231
231
{
232
- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
232
+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
233
233
$ encoder ->expects ($ this ->once ())
234
234
->method ('isPasswordValid ' )
235
235
->willReturn (true )
@@ -288,7 +288,7 @@ public function testPasswordUpgrades()
288
288
289
289
protected function getSupportedToken ()
290
290
{
291
- $ mock = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Authentication \\ Token \\ UsernamePasswordToken ' )->setMethods (['getCredentials ' , 'getUser ' , 'getProviderKey ' ])->disableOriginalConstructor ()->getMock ();
291
+ $ mock = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken::class )->setMethods (['getCredentials ' , 'getUser ' , 'getProviderKey ' ])->disableOriginalConstructor ()->getMock ();
292
292
$ mock
293
293
->expects ($ this ->any ())
294
294
->method ('getProviderKey ' )
@@ -309,14 +309,14 @@ protected function getProvider($user = null, $userChecker = null, $passwordEncod
309
309
}
310
310
311
311
if (null === $ userChecker ) {
312
- $ userChecker = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserCheckerInterface ' )->getMock ();
312
+ $ userChecker = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \User \UserCheckerInterface::class )->getMock ();
313
313
}
314
314
315
315
if (null === $ passwordEncoder ) {
316
316
$ passwordEncoder = new PlaintextPasswordEncoder ();
317
317
}
318
318
319
- $ encoderFactory = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ();
319
+ $ encoderFactory = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ();
320
320
$ encoderFactory
321
321
->expects ($ this ->any ())
322
322
->method ('getEncoder ' )
0 commit comments