Merge "Use more trivial HashConfig in CaptchaTest"

This commit is contained in:
jenkins-bot 2024-09-17 11:13:21 +00:00 committed by Gerrit Code Review
commit bac39ab8fe

View file

@ -1,6 +1,6 @@
<?php
use MediaWiki\Config\Config;
use MediaWiki\Config\HashConfig;
use MediaWiki\Context\RequestContext;
use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers;
use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha;
@ -122,8 +122,7 @@ class CaptchaTest extends MediaWikiIntegrationTestCase {
$testObject = new SimpleCaptcha();
$user = $this->createMock( User::class );
$user->method( 'isEmailConfirmed' )->willReturn( $userIsMailConfirmed );
$config = $this->createMock( Config::class );
$config->method( 'get' )->willReturn( $allowUserConfirmEmail );
$config = new HashConfig( [ 'AllowConfirmedEmail' => $allowUserConfirmEmail ] );
$actual = $testObject->canSkipCaptcha( $user, $config );
@ -144,7 +143,7 @@ class CaptchaTest extends MediaWikiIntegrationTestCase {
*/
public function testCanSkipCaptchaIPWhitelisted( $requestIP, $IPWhitelist, $expected ) {
$testObject = new SimpleCaptcha();
$config = $this->createMock( Config::class );
$config = new HashConfig( [ 'AllowConfirmedEmail' => false ] );
$request = $this->createMock( WebRequest::class );
$request->method( 'getIP' )->willReturn( $requestIP );