mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-18 02:41:01 +00:00
9ea898ba2a
Also added "composer fix" command. Change-Id: Ibda3fd002c577c7f7c41920d67ec44fedbd27cb8
50 lines
997 B
PHP
50 lines
997 B
PHP
<?php
|
|
|
|
class QuestyCaptchaTest extends MediaWikiTestCase {
|
|
/**
|
|
* @covers QuestyCaptcha::getCaptcha
|
|
* @dataProvider provideGetCaptcha
|
|
*/
|
|
public function testGetCaptcha( $config, $expected ) {
|
|
|
|
# setMwGlobals() requires $wgCaptchaQuestion to be set
|
|
if ( !isset( $GLOBALS['wgCaptchaQuestions'] ) ) {
|
|
$GLOBALS['wgCaptchaQuestions'] = [];
|
|
}
|
|
$this->setMwGlobals( 'wgCaptchaQuestions', $config );
|
|
$this->mergeMwGlobalArrayValue(
|
|
'wgAutoloadClasses',
|
|
[ 'QuestyCaptcha' => __DIR__ . '/../QuestyCaptcha/QuestyCaptcha.class.php' ]
|
|
);
|
|
|
|
$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!',
|
|
],
|
|
]
|
|
];
|
|
}
|
|
}
|