MediaWiki REL1_30
CaptchaAuthenticationRequestTest.php
Go to the documentation of this file.
1<?php
2
5
7 public function setUp() {
8 parent::setUp();
9 $this->setMwGlobals( [
10 'wgCaptchaClass' => 'SimpleCaptcha',
11 'wgCaptchaStorageClass' => CaptchaHashStore::class,
12 ] );
14 CaptchaStore::get()->clearAll();
15 CaptchaStore::get()->store( '345', [ 'question' => '2+2', 'answer' => '4' ] );
16 }
17
18 protected function getInstance( array $args = [] ) {
19 return new CaptchaAuthenticationRequest( $args[0], $args[1] );
20 }
21
22 public static function provideGetFieldInfo() {
23 return [
24 [ [ '123', [ 'question' => '1+2', 'answer' => '3' ] ] ],
25 ];
26 }
27
28 public function provideLoadFromSubmission() {
29 return [
30 'no id' => [
31 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
32 [],
33 false,
34 ],
35 'no answer' => [
36 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
37 [ 'captchaId' => '345' ],
38 false,
39 ],
40 'missing' => [
41 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
42 [ 'captchaId' => '234', 'captchaWord' => '5' ],
43 false,
44 ],
45 'normal' => [
46 [ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
47 [ 'captchaId' => '345', 'captchaWord' => '5' ],
48 [ 'captchaId' => '345', 'captchaData' => [ 'question' => '2+2', 'answer' => '4' ],
49 'captchaWord' => '5' ],
50 ],
51 ];
52 }
53}
if( $line===false) $args
Definition cdb.php:63
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.
This serves as the entry point to the authentication system.