2014-12-30 19:15:48 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 16:53:12 +00:00
|
|
|
use MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha;
|
|
|
|
|
2018-01-23 23:59:08 +00:00
|
|
|
/**
|
2022-04-08 16:53:12 +00:00
|
|
|
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha
|
2018-01-23 23:59:08 +00:00
|
|
|
*/
|
2021-10-11 22:36:53 +00:00
|
|
|
class QuestyCaptchaTest extends MediaWikiIntegrationTestCase {
|
2024-01-17 04:46:58 +00:00
|
|
|
|
2014-12-30 19:15:48 +00:00
|
|
|
/**
|
2022-04-08 16:53:12 +00:00
|
|
|
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha::getCaptcha
|
2014-12-30 19:15:48 +00:00
|
|
|
* @dataProvider provideGetCaptcha
|
|
|
|
*/
|
|
|
|
public function testGetCaptcha( $config, $expected ) {
|
2024-07-22 10:30:27 +00:00
|
|
|
$this->overrideConfigValue( 'CaptchaQuestions', $config );
|
2014-12-30 19:15:48 +00:00
|
|
|
|
|
|
|
$qc = new QuestyCaptcha();
|
|
|
|
$this->assertEquals( $expected, $qc->getCaptcha() );
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function provideGetCaptcha() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [
|
|
|
|
[
|
|
|
|
[
|
|
|
|
[
|
2014-12-30 19:15:48 +00:00
|
|
|
'question' => 'FooBar',
|
|
|
|
'answer' => 'Answer!',
|
2016-05-09 23:41:17 +00:00
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
2014-12-30 19:15:48 +00:00
|
|
|
'question' => 'FooBar',
|
|
|
|
'answer' => 'Answer!',
|
2016-05-09 23:41:17 +00:00
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
[
|
2014-12-30 19:15:48 +00:00
|
|
|
'FooBar' => 'Answer!',
|
2016-05-09 23:41:17 +00:00
|
|
|
],
|
|
|
|
[
|
2014-12-30 19:15:48 +00:00
|
|
|
'question' => 'FooBar',
|
|
|
|
'answer' => 'Answer!',
|
2016-05-09 23:41:17 +00:00
|
|
|
],
|
|
|
|
]
|
|
|
|
];
|
2014-12-30 19:15:48 +00:00
|
|
|
}
|
|
|
|
}
|