11<?php
2-
32declare (strict_types=1 );
43
54/**
1413
1514namespace CakeDC \Users \Test \TestCase \Controller \Traits ;
1615
16+ use Authentication \Authenticator \AuthenticatorCollection ;
1717use Authentication \Authenticator \Result ;
1818use Authentication \Authenticator \SessionAuthenticator ;
1919use Authentication \Identifier \IdentifierCollection ;
2929use CakeDC \Users \Authenticator \SocialAuthenticator ;
3030use CakeDC \Users \Controller \Component \LoginComponent ;
3131
32- use Authentication \Authenticator \AuthenticatorCollection ;
33-
3432class LoginTraitTest extends BaseTrait
3533{
3634 /**
@@ -153,8 +151,8 @@ public function testLoginRehash()
153151 {
154152 \Cake \Core \Configure::write ('Auth.PasswordRehash ' , [
155153 'authenticators ' => [
156- 'Form ' => 'Password '
157- ]
154+ 'Form ' => 'Password ' ,
155+ ],
158156 ]);
159157
160158 $ passwordIdentifier = $ this ->getMockBuilder (PasswordIdentifier::class)
@@ -217,8 +215,13 @@ public function testLoginRehash()
217215 $ request ->expects ($ this ->any ())
218216 ->method ('getData ' )
219217 ->willReturnCallback (function ($ key = null ) use ($ userPassword , $ user ) {
220- if ($ key === 'password ' ) return $ userPassword ;
221- if ($ key === 'username ' || $ key === 'email ' ) return $ user ->email ;
218+ if ($ key === 'password ' ) {
219+ return $ userPassword ;
220+ }
221+ if ($ key === 'username ' || $ key === 'email ' ) {
222+ return $ user ->email ;
223+ }
224+
222225 return [];
223226 });
224227
@@ -253,8 +256,8 @@ public function testLoginRehash()
253256 'component ' => 'CakeDC/Users.Login ' ,
254257 'targetAuthenticator ' => FormAuthenticator::class,
255258 'PasswordRehash ' => [
256- 'authenticators ' => ['Form ' => 'Password ' ]
257- ]
259+ 'authenticators ' => ['Form ' => 'Password ' ],
260+ ],
258261 ];
259262
260263 $ Login = $ this ->getMockBuilder (LoginComponent::class)
@@ -269,7 +272,7 @@ public function testLoginRehash()
269272 ->method ('loadComponent ' )
270273 ->with (
271274 $ this ->equalTo ('CakeDC/Users.Login ' ),
272- $ this ->anything ()
275+ $ this ->anything (),
273276 )
274277 ->willReturn ($ Login );
275278
@@ -287,8 +290,8 @@ public function testLoginRehashWithAuthenticatorStructure()
287290 {
288291 \Cake \Core \Configure::write ('Auth.PasswordRehash ' , [
289292 'authenticators ' => [
290- 'Form ' => 'Authentication.Password '
291- ]
293+ 'Form ' => 'Authentication.Password ' ,
294+ ],
292295 ]);
293296
294297 $ userId = '00000000-0000-0000-0000-000000000002 ' ;
@@ -353,8 +356,13 @@ public function testLoginRehashWithAuthenticatorStructure()
353356 $ request ->expects ($ this ->any ())
354357 ->method ('getData ' )
355358 ->willReturnCallback (function ($ key = null ) use ($ user ) {
356- if ($ key === 'password ' ) return 'password123 ' ;
357- if ($ key === 'username ' || $ key === 'email ' ) return $ user ->email ;
359+ if ($ key === 'password ' ) {
360+ return 'password123 ' ;
361+ }
362+ if ($ key === 'username ' || $ key === 'email ' ) {
363+ return $ user ->email ;
364+ }
365+
358366 return [];
359367 });
360368
@@ -382,8 +390,8 @@ public function testLoginRehashWithAuthenticatorStructure()
382390 'component ' => 'CakeDC/Users.Login ' ,
383391 'targetAuthenticator ' => FormAuthenticator::class,
384392 'PasswordRehash ' => [
385- 'authenticators ' => ['Form ' => 'Authentication.Password ' ]
386- ]
393+ 'authenticators ' => ['Form ' => 'Authentication.Password ' ],
394+ ],
387395 ];
388396
389397 $ Login = $ this ->getMockBuilder (LoginComponent::class)
@@ -399,7 +407,7 @@ public function testLoginRehashWithAuthenticatorStructure()
399407 ->method ('loadComponent ' )
400408 ->with (
401409 $ this ->equalTo ('CakeDC/Users.Login ' ),
402- $ this ->anything ()
410+ $ this ->anything (),
403411 )
404412 ->willReturn ($ Login );
405413
@@ -413,7 +421,7 @@ public function testLoginRehashWithAuthenticatorStructure()
413421
414422 $ this ->assertNotEquals (
415423 $ oldHash ,
416- $ userAfter ->password
424+ $ userAfter ->password ,
417425 );
418426 }
419427
0 commit comments