@@ -403,16 +403,18 @@ public function testLogClientInWithTokenPassword() {
403403 $ manager = $ this ->createMock (Manager::class);
404404 $ session = $ this ->createMock (ISession::class);
405405 $ request = $ this ->createMock (IRequest::class);
406+ $ token = $ this ->createMock (IToken::class);
406407
407408 /** @var Session $userSession */
408409 $ userSession = $ this ->getMockBuilder (Session::class)
409410 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
410- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
411+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
411412 ->getMock ();
412413
413- $ userSession ->expects ($ this ->once ())
414- ->method ('isTokenPassword ' )
415- ->willReturn (true );
414+ $ this ->tokenProvider ->expects ($ this ->once ())
415+ ->method ('getToken ' )
416+ ->with ('I-AM-AN-APP-PASSWORD ' )
417+ ->willReturn ($ token );
416418 $ userSession ->expects ($ this ->once ())
417419 ->method ('login ' )
418420 ->with ('john ' , 'I-AM-AN-APP-PASSWORD ' )
@@ -1063,16 +1065,18 @@ public function testLogClientInThrottlerUsername() {
10631065 $ manager = $ this ->createMock (Manager::class);
10641066 $ session = $ this ->createMock (ISession::class);
10651067 $ request = $ this ->createMock (IRequest::class);
1068+ $ token = $ this ->createMock (IToken::class);
10661069
10671070 /** @var Session $userSession */
10681071 $ userSession = $ this ->getMockBuilder (Session::class)
10691072 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1070- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1073+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
10711074 ->getMock ();
10721075
1073- $ userSession ->expects ($ this ->once ())
1074- ->method ('isTokenPassword ' )
1075- ->willReturn (true );
1076+ $ this ->tokenProvider ->expects ($ this ->once ())
1077+ ->method ('getToken ' )
1078+ ->with ('I-AM-AN-PASSWORD ' )
1079+ ->willReturn ($ token );
10761080 $ userSession ->expects ($ this ->once ())
10771081 ->method ('login ' )
10781082 ->with ('john ' , 'I-AM-AN-PASSWORD ' )
@@ -1113,12 +1117,13 @@ public function testLogClientInThrottlerEmail() {
11131117 /** @var Session $userSession */
11141118 $ userSession = $ this ->getMockBuilder (Session::class)
11151119 ->setConstructorArgs ([$ manager , $ session , $ this ->timeFactory , $ this ->tokenProvider , $ this ->config , $ this ->random , $ this ->lockdownManager , $ this ->logger , $ this ->dispatcher ])
1116- ->setMethods ([ ' isTokenPassword ' , 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
1120+ ->onlyMethods ([ 'login ' , 'supportsCookies ' , 'createSessionToken ' , 'getUser ' ])
11171121 ->getMock ();
11181122
1119- $ userSession ->expects ($ this ->once ())
1120- ->method ('isTokenPassword ' )
1121- ->willReturn (false );
1123+ $ this ->tokenProvider ->expects ($ this ->once ())
1124+ ->method ('getToken ' )
1125+ ->with ('I-AM-AN-PASSWORD ' )
1126+ ->willThrowException (new InvalidTokenException ());
11221127 $ userSession ->expects ($ this ->once ())
11231128 ->method ('login ' )
11241129 ->with ('john@foo.bar ' , 'I-AM-AN-PASSWORD ' )
0 commit comments