dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove passwordreset capture feature
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
auth
/
TemporaryPasswordPrimaryAuthenticationProviderTest.php
diff --git
a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
index
8161ed4
..
4b60622
100644
(file)
--- a/
tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
+++ b/
tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
@@
-2,6
+2,8
@@
namespace MediaWiki\Auth;
namespace MediaWiki\Auth;
+use Wikimedia\ScopedCallback;
+
/**
* @group AuthManager
* @group Database
/**
* @group AuthManager
* @group Database
@@
-70,7
+72,7
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
} );
}
} );
}
- return new
\
ScopedCallback( function () {
+ return new ScopedCallback( function () {
\Hooks::clear( 'AlternateUserMailer' );
\Hooks::register( 'AlternateUserMailer', function () {
return false;
\Hooks::clear( 'AlternateUserMailer' );
\Hooks::register( 'AlternateUserMailer', function () {
return false;
@@
-345,7
+347,6
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
'wrongpassword',
$ret->message->getKey()
);
'wrongpassword',
$ret->message->getKey()
);
-
}
/**
}
/**
@@
-414,7
+415,7
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$dbw = wfGetDB( DB_MASTER );
$oldHash = $dbw->selectField( 'user', 'user_newpassword', [ 'user_name' => $cuser ] );
$dbw = wfGetDB( DB_MASTER );
$oldHash = $dbw->selectField( 'user', 'user_newpassword', [ 'user_name' => $cuser ] );
- $cb = new
\
ScopedCallback( function () use ( $dbw, $cuser, $oldHash ) {
+ $cb = new ScopedCallback( function () use ( $dbw, $cuser, $oldHash ) {
$dbw->update( 'user', [ 'user_newpassword' => $oldHash ], [ 'user_name' => $cuser ] );
} );
$dbw->update( 'user', [ 'user_newpassword' => $oldHash ], [ 'user_name' => $cuser ] );
} );
@@
-451,7
+452,7
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$changeReq->password = $newpass;
$resetMailer = $this->hookMailer();
$provider->providerChangeAuthenticationData( $changeReq );
$changeReq->password = $newpass;
$resetMailer = $this->hookMailer();
$provider->providerChangeAuthenticationData( $changeReq );
-
\
ScopedCallback::consume( $resetMailer );
+ ScopedCallback::consume( $resetMailer );
$loginReq->password = $oldpass;
$ret = $provider->beginPrimaryAuthentication( $loginReqs );
$loginReq->password = $oldpass;
$ret = $provider->beginPrimaryAuthentication( $loginReqs );
@@
-519,10
+520,6
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$provider = $this->getProvider( [ 'emailEnabled' => false ] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertEquals( \StatusValue::newFatal( 'passwordreset-emaildisabled' ), $status );
$provider = $this->getProvider( [ 'emailEnabled' => false ] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$this->assertEquals( \StatusValue::newFatal( 'passwordreset-emaildisabled' ), $status );
- $req->hasBackchannel = true;
- $status = $provider->providerAllowsAuthenticationDataChange( $req, true );
- $this->assertFalse( $status->hasMessage( 'passwordreset-emaildisabled' ) );
- $req->hasBackchannel = false;
$provider = $this->getProvider( [ 'passwordReminderResendTime' => 10 ] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
$provider = $this->getProvider( [ 'passwordReminderResendTime' => 10 ] );
$status = $provider->providerAllowsAuthenticationDataChange( $req, true );
@@
-573,7
+570,7
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
return false;
} );
$provider->providerChangeAuthenticationData( $req );
return false;
} );
$provider->providerChangeAuthenticationData( $req );
-
\
ScopedCallback::consume( $resetMailer );
+ ScopedCallback::consume( $resetMailer );
$this->assertTrue( $mailed );
$priv = \TestingAccessWrapper::newFromObject( $provider );
$this->assertTrue( $mailed );
$priv = \TestingAccessWrapper::newFromObject( $provider );
@@
-685,18
+682,10
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$provider = $this->getProvider( [ 'emailEnabled' => false ] );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
$this->assertEquals( \StatusValue::newFatal( 'emaildisabled' ), $status );
$provider = $this->getProvider( [ 'emailEnabled' => false ] );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
$this->assertEquals( \StatusValue::newFatal( 'emaildisabled' ), $status );
- $req->hasBackchannel = true;
- $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
- $this->assertFalse( $status->hasMessage( 'emaildisabled' ) );
- $req->hasBackchannel = false;
$provider = $this->getProvider( [ 'emailEnabled' => true ] );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
$this->assertEquals( \StatusValue::newFatal( 'noemailcreate' ), $status );
$provider = $this->getProvider( [ 'emailEnabled' => true ] );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
$this->assertEquals( \StatusValue::newFatal( 'noemailcreate' ), $status );
- $req->hasBackchannel = true;
- $status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
- $this->assertFalse( $status->hasMessage( 'noemailcreate' ) );
- $req->hasBackchannel = false;
$user->setEmail( 'test@localhost.localdomain' );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
$user->setEmail( 'test@localhost.localdomain' );
$status = $provider->testForAccountCreation( $user, $creator, [ $req ] );
@@
-723,7
+712,7
@@
class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiTestC
$this->assertSame( 'byemail', $provider->finishAccountCreation( $user, $creator, $res ) );
$this->assertTrue( $mailed );
$this->assertSame( 'byemail', $provider->finishAccountCreation( $user, $creator, $res ) );
$this->assertTrue( $mailed );
-
\
ScopedCallback::consume( $resetMailer );
+ ScopedCallback::consume( $resetMailer );
$this->assertTrue( $mailed );
}
$this->assertTrue( $mailed );
}