mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
81a524e2e9
composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 npm: * postcss: 7.0.35 → 7.0.36 * https://npmjs.com/advisories/1693 (CVE-2021-23368) * glob-parent: 5.1.0 → 5.1.2 * https://npmjs.com/advisories/1751 (CVE-2020-28469) * trim-newlines: 3.0.0 → 3.0.1 * https://npmjs.com/advisories/1753 (CVE-2021-33623) Change-Id: I57837ebf8054a2e968d207fecb3f12397c18e2a2
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Auth\AuthenticationRequestTestCase;
|
|
|
|
/**
|
|
* @covers CaptchaAuthenticationRequest
|
|
*/
|
|
class CaptchaAuthenticationRequestTest extends AuthenticationRequestTestCase {
|
|
public function setUp(): void {
|
|
parent::setUp();
|
|
$this->setMwGlobals( [
|
|
'wgCaptchaClass' => SimpleCaptcha::class,
|
|
'wgCaptchaStorageClass' => CaptchaHashStore::class,
|
|
] );
|
|
CaptchaStore::unsetInstanceForTests();
|
|
CaptchaStore::get()->clearAll();
|
|
CaptchaStore::get()->store( '345', [ 'question' => '2+2', 'answer' => '4' ] );
|
|
}
|
|
|
|
protected function getInstance( array $args = [] ) {
|
|
return new CaptchaAuthenticationRequest( $args[0], $args[1] );
|
|
}
|
|
|
|
public static function provideGetFieldInfo() {
|
|
return [
|
|
[ [ '123', [ 'question' => '1+2', 'answer' => '3' ] ] ],
|
|
];
|
|
}
|
|
|
|
public function provideLoadFromSubmission() {
|
|
return [
|
|
'no id' => [
|
|
[ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
|
|
[],
|
|
false,
|
|
],
|
|
'no answer' => [
|
|
[ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
|
|
[ 'captchaId' => '345' ],
|
|
false,
|
|
],
|
|
'missing' => [
|
|
[ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
|
|
[ 'captchaId' => '234', 'captchaWord' => '5' ],
|
|
false,
|
|
],
|
|
'normal' => [
|
|
[ '123', [ 'question' => '1+2', 'answer' => '3' ] ],
|
|
[ 'captchaId' => '345', 'captchaWord' => '5' ],
|
|
[ 'captchaId' => '345', 'captchaData' => [ 'question' => '2+2', 'answer' => '4' ],
|
|
'captchaWord' => '5' ],
|
|
],
|
|
];
|
|
}
|
|
}
|