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:
thiemowmde 2024-09-13 12:57:46 +02:00 committed by Thiemo Kreuz (WMDE)
parent 5a86fd08ff
commit 7913547820

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;
@ -142,8 +142,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 );
@ -164,7 +163,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 );