@@ -482,16 +482,18 @@ public function testLogClientInWithTokenPassword(): void {
482482 $ manager = $ this ->createMock (Manager::class);
483483 $ session = $ this ->createMock (ISession::class);
484484 $ request = $ this ->createMock (IRequest::class);
485+ $ token = $ this ->createMock (IToken::class);
485486
486487 /** @var Session $userSession */
487488 $ userSession = $ this ->getMockBuilder (Session::class)
488489 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
489- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
490+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
490491 ->getMock ();
491492
492- $ userSession ->expects ($ this ->once ())
493- ->method ('isTokenPassword ' )
494- ->willReturn (true );
493+ $ this ->tokenProvider ->expects ($ this ->once ())
494+ ->method ('getToken ' )
495+ ->with ('I-AM-AN-APP-PASSWORD ' )
496+ ->willReturn ($ token );
495497 $ userSession ->expects ($ this ->once ())
496498 ->method ('login ' )
497499 ->with ('john ' , 'I-AM-AN-APP-PASSWORD ' )
@@ -1231,16 +1233,18 @@ public function testLogClientInThrottlerUsername(): void {
12311233 $ manager = $ this ->createMock (Manager::class);
12321234 $ session = $ this ->createMock (ISession::class);
12331235 $ request = $ this ->createMock (IRequest::class);
1236+ $ token = $ this ->createMock (IToken::class);
12341237
12351238 /** @var Session $userSession */
12361239 $ userSession = $ this ->getMockBuilder (Session::class)
12371240 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1238- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1241+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12391242 ->getMock ();
12401243
1241- $ userSession ->expects ($ this ->once ())
1242- ->method ('isTokenPassword ' )
1243- ->willReturn (true );
1244+ $ this ->tokenProvider ->expects ($ this ->once ())
1245+ ->method ('getToken ' )
1246+ ->with ('I-AM-AN-PASSWORD ' )
1247+ ->willReturn ($ token );
12441248 $ userSession ->expects ($ this ->once ())
12451249 ->method ('login ' )
12461250 ->with ('john ' , 'I-AM-AN-PASSWORD ' )
@@ -1281,12 +1285,13 @@ public function testLogClientInThrottlerEmail(): void {
12811285 /** @var Session $userSession */
12821286 $ userSession = $ this ->getMockBuilder (Session::class)
12831287 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1284- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1288+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12851289 ->getMock ();
12861290
1287- $ userSession ->expects ($ this ->once ())
1288- ->method ('isTokenPassword ' )
1289- ->willReturn (false );
1291+ $ this ->tokenProvider ->expects ($ this ->once ())
1292+ ->method ('getToken ' )
1293+ ->with ('I-AM-AN-PASSWORD ' )
1294+ ->willThrowException (new InvalidTokenException ());
12901295 $ userSession ->expects ($ this ->once ())
12911296 ->method ('login ' )
12921297 ->with ('john@foo.bar ' , 'I-AM-AN-PASSWORD ' )
0 commit comments