| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
class QuestyCaptchaTest extends MediaWikiIntegrationTestCase { |
| 9 |
|
| 10 |
public function setUp(): void { |
| 11 |
parent::setUp(); |
| 12 |
|
| 13 |
$this->mergeMwGlobalArrayValue( |
| 14 |
'wgAutoloadClasses', |
| 15 |
[ 'MediaWiki\\Extension\\ConfirmEdit\\QuestyCaptcha\\QuestyCaptcha' |
| 16 |
=> __DIR__ . '/../../QuestyCaptcha/includes/QuestyCaptcha.php' ] |
| 17 |
); |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public function testGetCaptcha( $config, $expected ) { |
| 25 |
$this->overrideConfigValue( 'CaptchaQuestions', $config ); |
| 26 |
|
| 27 |
$qc = new QuestyCaptcha(); |
| 28 |
$this->assertEquals( $expected, $qc->getCaptcha() ); |
| 29 |
} |
| 30 |
|
| 31 |
public static function provideGetCaptcha() { |
| 32 |
return [ |
| 33 |
[ |
| 34 |
[ |
| 35 |
[ |
| 36 |
'question' => 'FooBar', |
| 37 |
'answer' => 'Answer!', |
| 38 |
], |
| 39 |
], |
| 40 |
[ |
| 41 |
'question' => 'FooBar', |
| 42 |
'answer' => 'Answer!', |
| 43 |
], |
| 44 |
], |
| 45 |
[ |
| 46 |
[ |
| 47 |
'FooBar' => 'Answer!', |
| 48 |
], |
| 49 |
[ |
| 50 |
'question' => 'FooBar', |
| 51 |
'answer' => 'Answer!', |
| 52 |
], |
| 53 |
] |
| 54 |
]; |
| 55 |
} |
| 56 |
} |