mediawiki-extensions-Confir.../tests/phpunit/QuestyCaptchaTest.php

47 lines
910 B
PHP
Raw Normal View History

<?php
use MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha;
/**
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha
*/
class QuestyCaptchaTest extends MediaWikiIntegrationTestCase {
/**
* @covers \MediaWiki\Extension\ConfirmEdit\QuestyCaptcha\QuestyCaptcha::getCaptcha
* @dataProvider provideGetCaptcha
*/
public function testGetCaptcha( $config, $expected ) {
$this->overrideConfigValue( 'CaptchaQuestions', $config );
$qc = new QuestyCaptcha();
$this->assertEquals( $expected, $qc->getCaptcha() );
}
public static function provideGetCaptcha() {
return [
[
[
[
'question' => 'FooBar',
'answer' => 'Answer!',
],
],
[
'question' => 'FooBar',
'answer' => 'Answer!',
],
],
[
[
'FooBar' => 'Answer!',
],
[
'question' => 'FooBar',
'answer' => 'Answer!',
],
]
];
}
}