@@ -25,7 +25,7 @@ class DaoAuthenticationProviderTest extends TestCase
2525{
2626 public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface ()
2727 {
28- $ this ->expectException (' Symfony\Component\Security\Core\Exception\AuthenticationServiceException ' );
28+ $ this ->expectException (\ Symfony \Component \Security \Core \Exception \AuthenticationServiceException::class );
2929 $ provider = $ this ->getProvider ('fabien ' );
3030 $ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
3131 $ method ->setAccessible (true );
@@ -35,14 +35,14 @@ public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
3535
3636 public function testRetrieveUserWhenUsernameIsNotFound ()
3737 {
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 ();
4040 $ userProvider ->expects ($ this ->once ())
4141 ->method ('loadUserByUsername ' )
4242 ->willThrowException (new UsernameNotFoundException ())
4343 ;
4444
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 ());
4646 $ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
4747 $ method ->setAccessible (true );
4848
@@ -51,14 +51,14 @@ public function testRetrieveUserWhenUsernameIsNotFound()
5151
5252 public function testRetrieveUserWhenAnExceptionOccurs ()
5353 {
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 ();
5656 $ userProvider ->expects ($ this ->once ())
5757 ->method ('loadUserByUsername ' )
5858 ->willThrowException (new \RuntimeException ())
5959 ;
6060
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 ());
6262 $ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
6363 $ method ->setAccessible (true );
6464
@@ -67,7 +67,7 @@ public function testRetrieveUserWhenAnExceptionOccurs()
6767
6868 public function testRetrieveUserReturnsUserFromTokenOnReauthentication ()
6969 {
70- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
70+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
7171 $ userProvider ->expects ($ this ->never ())
7272 ->method ('loadUserByUsername ' )
7373 ;
@@ -79,7 +79,7 @@ public function testRetrieveUserReturnsUserFromTokenOnReauthentication()
7979 ->willReturn ($ user )
8080 ;
8181
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 ());
8383 $ reflection = new \ReflectionMethod ($ provider , 'retrieveUser ' );
8484 $ reflection ->setAccessible (true );
8585 $ result = $ reflection ->invoke ($ provider , 'someUser ' , $ token );
@@ -91,13 +91,13 @@ public function testRetrieveUser()
9191 {
9292 $ user = new TestUser ();
9393
94- $ userProvider = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserProviderInterface ' )->getMock ();
94+ $ userProvider = $ this ->getMockBuilder (UserProviderInterface::class )->getMock ();
9595 $ userProvider ->expects ($ this ->once ())
9696 ->method ('loadUserByUsername ' )
9797 ->willReturn ($ user )
9898 ;
9999
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 ());
101101 $ method = new \ReflectionMethod ($ provider , 'retrieveUser ' );
102102 $ method ->setAccessible (true );
103103
@@ -106,8 +106,8 @@ public function testRetrieveUser()
106106
107107 public function testCheckAuthenticationWhenCredentialsAreEmpty ()
108108 {
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 ();
111111 $ encoder
112112 ->expects ($ this ->never ())
113113 ->method ('isPasswordValid ' )
@@ -129,7 +129,7 @@ public function testCheckAuthenticationWhenCredentialsAreEmpty()
129129
130130 public function testCheckAuthenticationWhenCredentialsAre0 ()
131131 {
132- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
132+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
133133 $ encoder
134134 ->expects ($ this ->once ())
135135 ->method ('isPasswordValid ' )
@@ -156,8 +156,8 @@ public function testCheckAuthenticationWhenCredentialsAre0()
156156
157157 public function testCheckAuthenticationWhenCredentialsAreNotValid ()
158158 {
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 ();
161161 $ encoder ->expects ($ this ->once ())
162162 ->method ('isPasswordValid ' )
163163 ->willReturn (false )
@@ -178,8 +178,8 @@ public function testCheckAuthenticationWhenCredentialsAreNotValid()
178178
179179 public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChanged ()
180180 {
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 ();
183183 $ user ->expects ($ this ->once ())
184184 ->method ('getPassword ' )
185185 ->willReturn ('foo ' )
@@ -190,7 +190,7 @@ public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChang
190190 ->method ('getUser ' )
191191 ->willReturn ($ user );
192192
193- $ dbUser = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
193+ $ dbUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
194194 $ dbUser ->expects ($ this ->once ())
195195 ->method ('getPassword ' )
196196 ->willReturn ('newFoo ' )
@@ -204,7 +204,7 @@ public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChang
204204
205205 public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithoutOriginalCredentials ()
206206 {
207- $ user = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
207+ $ user = $ this ->getMockBuilder (UserInterface::class )->getMock ();
208208 $ user ->expects ($ this ->once ())
209209 ->method ('getPassword ' )
210210 ->willReturn ('foo ' )
@@ -215,7 +215,7 @@ public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithou
215215 ->method ('getUser ' )
216216 ->willReturn ($ user );
217217
218- $ dbUser = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface ' )->getMock ();
218+ $ dbUser = $ this ->getMockBuilder (UserInterface::class )->getMock ();
219219 $ dbUser ->expects ($ this ->once ())
220220 ->method ('getPassword ' )
221221 ->willReturn ('foo ' )
@@ -229,7 +229,7 @@ public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithou
229229
230230 public function testCheckAuthentication ()
231231 {
232- $ encoder = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ PasswordEncoderInterface ' )->getMock ();
232+ $ encoder = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \PasswordEncoderInterface::class )->getMock ();
233233 $ encoder ->expects ($ this ->once ())
234234 ->method ('isPasswordValid ' )
235235 ->willReturn (true )
@@ -288,7 +288,7 @@ public function testPasswordUpgrades()
288288
289289 protected function getSupportedToken ()
290290 {
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 ();
292292 $ mock
293293 ->expects ($ this ->any ())
294294 ->method ('getProviderKey ' )
@@ -309,14 +309,14 @@ protected function getProvider($user = null, $userChecker = null, $passwordEncod
309309 }
310310
311311 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 ();
313313 }
314314
315315 if (null === $ passwordEncoder ) {
316316 $ passwordEncoder = new PlaintextPasswordEncoder ();
317317 }
318318
319- $ encoderFactory = $ this ->getMockBuilder (' Symfony \\ Component \\ Security \\ Core \\ Encoder \\ EncoderFactoryInterface ' )->getMock ();
319+ $ encoderFactory = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Encoder \EncoderFactoryInterface::class )->getMock ();
320320 $ encoderFactory
321321 ->expects ($ this ->any ())
322322 ->method ('getEncoder ' )
0 commit comments