mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-14 19:30:11 +00:00
07646e4a65
Change-Id: If63e84d8101f2169f684c4db822f7df907d2deec
57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha
|
|
*/
|
|
class QuestyCaptchaTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function setUp(): void {
|
|
parent::setUp();
|
|
|
|
$this->mergeMwGlobalArrayValue(
|
|
'wgAutoloadClasses',
|
|
[ 'MediaWiki\\Extension\\ConfirmEdit\\QuestyCaptcha\\QuestyCaptcha'
|
|
=> __DIR__ . '/../../QuestyCaptcha/includes/QuestyCaptcha.php' ]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha::getCaptcha
|
|
* @dataProvider provideGetCaptcha
|
|
*/
|
|
public function testGetCaptcha( $config, $expected ) {
|
|
$this->overrideConfigValue( 'CaptchaQuestions', $config );
|
|
|
|
$qc = new QuestyCaptcha();
|
|
$this->assertEquals( $expected, $qc->getCaptcha() );
|
|
}
|
|
|
|
public static function provideGetCaptcha() {
|
|
return [
|
|
[
|
|
[
|
|
[
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
],
|
|
],
|
|
[
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
],
|
|
],
|
|
[
|
|
[
|
|
'FooBar' => 'Answer!',
|
|
],
|
|
[
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
],
|
|
]
|
|
];
|
|
}
|
|
}
|