MediaWiki REL1_33
CaptchaAuthenticationRequestTest.php
Go to the documentation of this file.
1<?php
2
4
9 public function setUp() {
10 parent::setUp();
11 $this->setMwGlobals( [
12 'wgCaptchaClass' => SimpleCaptcha::class,
13 'wgCaptchaStorageClass' => CaptchaHashStore::class,
14 ] );
16 CaptchaStore::get()->clearAll();
17 CaptchaStore::get()->store( '345', [ 'question' => '2+2', 'answer' => '4' ] );
18 }
19
20 protected function getInstance( array $args = [] ) {
21 return new CaptchaAuthenticationRequest( $args[0], $args[1] );
22 }
23
24 public static function provideGetFieldInfo() {
25 return [
26 [ [ '123', [ 'question' => '1+2', 'answer' => '3' ] ] ],
27 ];
28 }
29
30 public function provideLoadFromSubmission() {
31 return [
32 'no id' => [
33 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
34 [],
35 false,
36 ],
37 'no answer' => [
38 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
39 [ 'captchaId' => '345' ],
40 false,
41 ],
42 'missing' => [
43 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
44 [ 'captchaId' => '234', 'captchaWord' => '5' ],
45 false,
46 ],
47 'normal' => [
48 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
49 [ 'captchaId' => '345', 'captchaWord' => '5' ],
50 [ 'captchaId' => '345', 'captchaData' => [ 'question' => '2+2', 'answer' => '4' ],
51 'captchaWord' => '5' ],
52 ],
53 ];
54 }
55}
if( $line===false) $args
Definition cdb.php:64
Generic captcha authentication request class.
static unsetInstanceForTests()
static get()
Get somewhere to store captcha data that will persist between requests.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))