@@ -483,16 +483,18 @@ public function testLogClientInWithTokenPassword() {
483483 $ manager = $ this ->createMock (Manager::class);
484484 $ session = $ this ->createMock (ISession::class);
485485 $ request = $ this ->createMock (IRequest::class);
486+ $ token = $ this ->createMock (IToken::class);
486487
487488 /** @var Session $userSession */
488489 $ userSession = $ this ->getMockBuilder (Session::class)
489490 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
490- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
491+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
491492 ->getMock ();
492493
493- $ userSession ->expects ($ this ->once ())
494- ->method ('isTokenPassword ' )
495- ->willReturn (true );
494+ $ this ->tokenProvider ->expects ($ this ->once ())
495+ ->method ('getToken ' )
496+ ->with ('I-AM-AN-APP-PASSWORD ' )
497+ ->willReturn ($ token );
496498 $ userSession ->expects ($ this ->once ())
497499 ->method ('login ' )
498500 ->with ('john ' , 'I-AM-AN-APP-PASSWORD ' )
@@ -1232,16 +1234,18 @@ public function testLogClientInThrottlerUsername() {
12321234 $ manager = $ this ->createMock (Manager::class);
12331235 $ session = $ this ->createMock (ISession::class);
12341236 $ request = $ this ->createMock (IRequest::class);
1237+ $ token = $ this ->createMock (IToken::class);
12351238
12361239 /** @var Session $userSession */
12371240 $ userSession = $ this ->getMockBuilder (Session::class)
12381241 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1239- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1242+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12401243 ->getMock ();
12411244
1242- $ userSession ->expects ($ this ->once ())
1243- ->method ('isTokenPassword ' )
1244- ->willReturn (true );
1245+ $ this ->tokenProvider ->expects ($ this ->once ())
1246+ ->method ('getToken ' )
1247+ ->with ('I-AM-AN-PASSWORD ' )
1248+ ->willReturn ($ token );
12451249 $ userSession ->expects ($ this ->once ())
12461250 ->method ('login ' )
12471251 ->with ('john ' , 'I-AM-AN-PASSWORD ' )
@@ -1282,12 +1286,13 @@ public function testLogClientInThrottlerEmail() {
12821286 /** @var Session $userSession */
12831287 $ userSession = $ this ->getMockBuilder (Session::class)
12841288 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1285- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1289+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12861290 ->getMock ();
12871291
1288- $ userSession ->expects ($ this ->once ())
1289- ->method ('isTokenPassword ' )
1290- ->willReturn (false );
1292+ $ this ->tokenProvider ->expects ($ this ->once ())
1293+ ->method ('getToken ' )
1294+ ->with ('I-AM-AN-PASSWORD ' )
1295+ ->willThrowException (new InvalidTokenException ());
12911296 $ userSession ->expects ($ this ->once ())
12921297 ->method ('login ' )
12931298 ->with ('john@foo.bar ' , 'I-AM-AN-PASSWORD ' )
0 commit comments