MediaWiki REL1_32
HTMLReCaptchaFieldTest.php
Go to the documentation of this file.
1<?php
2
6class HTMLReCaptchaFieldTest extends PHPUnit\Framework\TestCase {
7 public function testSubmit() {
8 $form = new HTMLForm( [
9 'foo' => [
10 'class' => HTMLReCaptchaField::class,
11 'key' => '123',
12 'theme' => 'x',
13 ],
14 ] );
15 $mockClosure = $this->getMockBuilder( stdClass::class )
16 ->setMethods( [ '__invoke' ] )->getMock();
17 $mockClosure->expects( $this->once() )->method( '__invoke' )
18 ->with( [] )->willReturn( true );
19
20 $form->setTitle( Title::newFromText( 'Title' ) );
21 $form->setSubmitCallback( $mockClosure );
22 $form->prepareForm();
23 $form->trySubmit();
24 }
25}
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition HTMLForm.php:136