@@ -484,16 +484,18 @@ public function testLogClientInWithTokenPassword() {
484484 $ manager = $ this ->createMock (Manager::class);
485485 $ session = $ this ->createMock (ISession::class);
486486 $ request = $ this ->createMock (IRequest::class);
487+ $ token = $ this ->createMock (IToken::class);
487488
488489 /** @var Session $userSession */
489490 $ userSession = $ this ->getMockBuilder (Session::class)
490491 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
491- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
492+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
492493 ->getMock ();
493494
494- $ userSession ->expects ($ this ->once ())
495- ->method ('isTokenPassword ' )
496- ->willReturn (true );
495+ $ this ->tokenProvider ->expects ($ this ->once ())
496+ ->method ('getToken ' )
497+ ->with ('I-AM-AN-APP-PASSWORD ' )
498+ ->willReturn ($ token );
497499 $ userSession ->expects ($ this ->once ())
498500 ->method ('login ' )
499501 ->with ('john ' , 'I-AM-AN-APP-PASSWORD ' )
@@ -1233,16 +1235,18 @@ public function testLogClientInThrottlerUsername() {
12331235 $ manager = $ this ->createMock (Manager::class);
12341236 $ session = $ this ->createMock (ISession::class);
12351237 $ request = $ this ->createMock (IRequest::class);
1238+ $ token = $ this ->createMock (IToken::class);
12361239
12371240 /** @var Session $userSession */
12381241 $ userSession = $ this ->getMockBuilder (Session::class)
12391242 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1240- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1243+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12411244 ->getMock ();
12421245
1243- $ userSession ->expects ($ this ->once ())
1244- ->method ('isTokenPassword ' )
1245- ->willReturn (true );
1246+ $ this ->tokenProvider ->expects ($ this ->once ())
1247+ ->method ('getToken ' )
1248+ ->with ('I-AM-AN-PASSWORD ' )
1249+ ->willReturn ($ token );
12461250 $ userSession ->expects ($ this ->once ())
12471251 ->method ('login ' )
12481252 ->with ('john ' , 'I-AM-AN-PASSWORD ' )
@@ -1283,12 +1287,13 @@ public function testLogClientInThrottlerEmail() {
12831287 /** @var Session $userSession */
12841288 $ userSession = $ this ->getMockBuilder (Session::class)
12851289 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1286- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1290+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12871291 ->getMock ();
12881292
1289- $ userSession ->expects ($ this ->once ())
1290- ->method ('isTokenPassword ' )
1291- ->willReturn (false );
1293+ $ this ->tokenProvider ->expects ($ this ->once ())
1294+ ->method ('getToken ' )
1295+ ->with ('I-AM-AN-PASSWORD ' )
1296+ ->willThrowException (new InvalidTokenException ());
12921297 $ userSession ->expects ($ this ->once ())
12931298 ->method ('login ' )
12941299 ->with ('john@foo.bar ' , 'I-AM-AN-PASSWORD ' )
0 commit comments