mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-30 10:54:53 +00:00
2f0db346eb
Bug: T88047 Change-Id: I8c8f97d49dc39445dbba9c12909b81898838a253
50 lines
1 KiB
PHP
50 lines
1 KiB
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'] = array();
|
|
}
|
|
$this->setMwGlobals( 'wgCaptchaQuestions', $config );
|
|
$this->mergeMwGlobalArrayValue(
|
|
'wgAutoloadClasses',
|
|
array( 'QuestyCaptcha' => __DIR__ . '/../QuestyCaptcha/QuestyCaptcha.class.php' )
|
|
);
|
|
|
|
$qc = new QuestyCaptcha();
|
|
$this->assertEquals( $expected, $qc->getCaptcha() );
|
|
}
|
|
|
|
public static function provideGetCaptcha() {
|
|
return array(
|
|
array(
|
|
array(
|
|
array(
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
),
|
|
),
|
|
array(
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
),
|
|
),
|
|
array(
|
|
array(
|
|
'FooBar' => 'Answer!',
|
|
),
|
|
array(
|
|
'question' => 'FooBar',
|
|
'answer' => 'Answer!',
|
|
),
|
|
)
|
|
);
|
|
}
|
|
}
|