From 791354782014a9d4a70aae7a90b99e0e8cd86a99 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Fri, 13 Sep 2024 12:57:46 +0200 Subject: [PATCH] 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 --- tests/phpunit/SimpleCaptcha/CaptchaTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/SimpleCaptcha/CaptchaTest.php b/tests/phpunit/SimpleCaptcha/CaptchaTest.php index e392dfaeb..59cb13733 100644 --- a/tests/phpunit/SimpleCaptcha/CaptchaTest.php +++ b/tests/phpunit/SimpleCaptcha/CaptchaTest.php @@ -1,6 +1,6 @@ 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 );