mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-30 10:54:53 +00:00
Merge "Use more trivial HashConfig in CaptchaTest"
This commit is contained in:
commit
bac39ab8fe
|
@ -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;
|
||||||
|
@ -122,8 +122,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 );
|
||||||
|
|
||||||
|
@ -144,7 +143,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