Enable email in TemporaryPasswordPrimaryAuthenticationProviderTest

Change-Id: I1bc01a3634d11c56292881be7e6477e37ac61d03
This commit is contained in:
Umherirrender 2019-03-26 19:50:28 +01:00
parent cb79b0207e
commit 2fcaf74be7

View file

@ -191,7 +191,8 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
* @param array $expected
*/
public function testGetAuthenticationRequests( $action, $options, $expected ) {
$actual = $this->getProvider()->getAuthenticationRequests( $action, $options );
$actual = $this->getProvider( [ 'emailEnabled' => true ] )
->getAuthenticationRequests( $action, $options );
foreach ( $actual as $req ) {
if ( $req instanceof TemporaryPasswordAuthenticationRequest && $req->password !== null ) {
$req->password = 'random';
@ -521,11 +522,15 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertEquals( \StatusValue::newFatal( 'passwordreset-emaildisabled' ), $status );
$provider = $this->getProvider( [ 'passwordReminderResendTime' => 10 ] );
$provider = $this->getProvider( [
'emailEnabled' => true, 'passwordReminderResendTime' => 10
] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertEquals( \StatusValue::newFatal( 'throttled-mailpassword', 10 ), $status );
$provider = $this->getProvider( [ 'passwordReminderResendTime' => 3 ] );
$provider = $this->getProvider( [
'emailEnabled' => true, 'passwordReminderResendTime' => 3
] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertFalse( $status->hasMessage( 'throttled-mailpassword' ) );
@ -534,7 +539,9 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
[ 'user_newpass_time' => $dbw->timestamp( time() + 5 * 3600 ) ],
[ 'user_id' => $user->getId() ]
);
$provider = $this->getProvider( [ 'passwordReminderResendTime' => 0 ] );
$provider = $this->getProvider( [
'emailEnabled' => true, 'passwordReminderResendTime' => 0
] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertFalse( $status->hasMessage( 'throttled-mailpassword' ) );