mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-04 04:28:30 +00:00
Use more trivial HashConfig in CaptchaTest
HashConfig is a rather trivial value class with not much behavior. The complexity of an actual moc is not needed here, it seems. Change-Id: I80025e67f248889ffff4d7237793e7d83dd269d5
This commit is contained in:
parent
5a86fd08ff
commit
7913547820
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use MediaWiki\Config\Config;
|
use MediaWiki\Config\HashConfig;
|
||||||
use MediaWiki\Context\RequestContext;
|
use MediaWiki\Context\RequestContext;
|
||||||
use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers;
|
use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers;
|
||||||
use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha;
|
use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha;
|
||||||
|
@ -142,8 +142,7 @@ class CaptchaTest extends MediaWikiIntegrationTestCase {
|
||||||
$testObject = new SimpleCaptcha();
|
$testObject = new SimpleCaptcha();
|
||||||
$user = $this->createMock( User::class );
|
$user = $this->createMock( User::class );
|
||||||
$user->method( 'isEmailConfirmed' )->willReturn( $userIsMailConfirmed );
|
$user->method( 'isEmailConfirmed' )->willReturn( $userIsMailConfirmed );
|
||||||
$config = $this->createMock( Config::class );
|
$config = new HashConfig( [ 'AllowConfirmedEmail' => $allowUserConfirmEmail ] );
|
||||||
$config->method( 'get' )->willReturn( $allowUserConfirmEmail );
|
|
||||||
|
|
||||||
$actual = $testObject->canSkipCaptcha( $user, $config );
|
$actual = $testObject->canSkipCaptcha( $user, $config );
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ class CaptchaTest extends MediaWikiIntegrationTestCase {
|
||||||
*/
|
*/
|
||||||
public function testCanSkipCaptchaIPWhitelisted( $requestIP, $IPWhitelist, $expected ) {
|
public function testCanSkipCaptchaIPWhitelisted( $requestIP, $IPWhitelist, $expected ) {
|
||||||
$testObject = new SimpleCaptcha();
|
$testObject = new SimpleCaptcha();
|
||||||
$config = $this->createMock( Config::class );
|
$config = new HashConfig( [ 'AllowConfirmedEmail' => false ] );
|
||||||
$request = $this->createMock( WebRequest::class );
|
$request = $this->createMock( WebRequest::class );
|
||||||
$request->method( 'getIP' )->willReturn( $requestIP );
|
$request->method( 'getIP' )->willReturn( $requestIP );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue