summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ConfirmEdit/tests/HTMLReCaptchaFieldTest.php
blob: a97b17a5ef7e0bee55fe397cfcdc1c1e18c57742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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();
	}
}