@@ -405,16 +405,18 @@ public function testLogClientInWithTokenPassword() {
405405 $ manager = $ this ->createMock (Manager::class);
406406 $ session = $ this ->createMock (ISession::class);
407407 $ request = $ this ->createMock (IRequest::class);
408+ $ token = $ this ->createMock (IToken::class);
408409
409410 /** @var Session $userSession */
410411 $ userSession = $ this ->getMockBuilder (Session::class)
411412 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
412- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
413+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
413414 ->getMock ();
414415
415- $ userSession ->expects ($ this ->once ())
416- ->method ('isTokenPassword ' )
417- ->willReturn (true );
416+ $ this ->tokenProvider ->expects ($ this ->once ())
417+ ->method ('getToken ' )
418+ ->with ('I-AM-AN-APP-PASSWORD ' )
419+ ->willReturn ($ token );
418420 $ userSession ->expects ($ this ->once ())
419421 ->method ('login ' )
420422 ->with ('john ' , 'I-AM-AN-APP-PASSWORD ' )
@@ -1154,16 +1156,18 @@ public function testLogClientInThrottlerUsername() {
11541156 $ manager = $ this ->createMock (Manager::class);
11551157 $ session = $ this ->createMock (ISession::class);
11561158 $ request = $ this ->createMock (IRequest::class);
1159+ $ token = $ this ->createMock (IToken::class);
11571160
11581161 /** @var Session $userSession */
11591162 $ userSession = $ this ->getMockBuilder (Session::class)
11601163 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1161- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1164+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
11621165 ->getMock ();
11631166
1164- $ userSession ->expects ($ this ->once ())
1165- ->method ('isTokenPassword ' )
1166- ->willReturn (true );
1167+ $ this ->tokenProvider ->expects ($ this ->once ())
1168+ ->method ('getToken ' )
1169+ ->with ('I-AM-AN-PASSWORD ' )
1170+ ->willReturn ($ token );
11671171 $ userSession ->expects ($ this ->once ())
11681172 ->method ('login ' )
11691173 ->with ('john ' , 'I-AM-AN-PASSWORD ' )
@@ -1204,12 +1208,13 @@ public function testLogClientInThrottlerEmail() {
12041208 /** @var Session $userSession */
12051209 $ userSession = $ this ->getMockBuilder (Session::class)
12061210 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1207- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1211+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
12081212 ->getMock ();
12091213
1210- $ userSession ->expects ($ this ->once ())
1211- ->method ('isTokenPassword ' )
1212- ->willReturn (false );
1214+ $ this ->tokenProvider ->expects ($ this ->once ())
1215+ ->method ('getToken ' )
1216+ ->with ('I-AM-AN-PASSWORD ' )
1217+ ->willThrowException (new InvalidTokenException ());
12131218 $ userSession ->expects ($ this ->once ())
12141219 ->method ('login ' )
12151220 ->with ('john@foo.bar ' , 'I-AM-AN-PASSWORD ' )
0 commit comments