MediaWiki REL1_30
QuestyCaptchaTest.php
Go to the documentation of this file.
1<?php
2
8 public function testGetCaptcha( $config, $expected ) {
9 # setMwGlobals() requires $wgCaptchaQuestion to be set
10 if ( !isset( $GLOBALS['wgCaptchaQuestions'] ) ) {
11 $GLOBALS['wgCaptchaQuestions'] = [];
12 }
13 $this->setMwGlobals( 'wgCaptchaQuestions', $config );
15 'wgAutoloadClasses',
16 [ 'QuestyCaptcha' => __DIR__ . '/../../QuestyCaptcha/QuestyCaptcha.class.php' ]
17 );
18
19 $qc = new QuestyCaptcha();
20 $this->assertEquals( $expected, $qc->getCaptcha() );
21 }
22
23 public static function provideGetCaptcha() {
24 return [
25 [
26 [
27 [
28 'question' => 'FooBar',
29 'answer' => 'Answer!',
30 ],
31 ],
32 [
33 'question' => 'FooBar',
34 'answer' => 'Answer!',
35 ],
36 ],
37 [
38 [
39 'FooBar' => 'Answer!',
40 ],
41 [
42 'question' => 'FooBar',
43 'answer' => 'Answer!',
44 ],
45 ]
46 ];
47 }
48}
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
Definition Autoload.php:10
mergeMwGlobalArrayValue( $name, $values)
Merges the given values into a MW global array variable.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
testGetCaptcha( $config, $expected)
QuestyCaptcha::getCaptcha provideGetCaptcha.