mediawiki-extensions-Confir.../tests/HTMLReCaptchaFieldTest.php
Gergő Tisza 3e3b91b527 Add AuthManager support for ReCaptcha, ReCaptchaNoCaptcha
Also remove references to "two words" from ReCaptcha labels.
The captcha image doesn't always contain two words.

Bug: T110302
Change-Id: I544656289480056152a1db195babb6dadf29bc71
2016-05-16 09:51:11 +00:00

24 lines
645 B
PHP

<?php
require_once __DIR__ . '/../ReCaptcha/HTMLReCaptchaField.php';
class HTMLReCaptchaFieldTest extends PHPUnit_Framework_TestCase {
public function testSubmit() {
$form = new HTMLForm( [
'foo' => [
'class' => HTMLReCaptchaField::class,
'key' => '123',
'theme' => 'x',
],
] );
$mockClosure = $this->getMockBuilder( 'object' )->setMethods( [ '__invoke' ] )->getMock();
$mockClosure->expects( $this->once() )->method( '__invoke' )
->with( [] )->willReturn( true );
$form->setTitle( Title::newFromText( 'Title' ) );
$form->setSubmitCallback( $mockClosure );
$form->prepareForm();
$form->trySubmit();
}
}