mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-15 11:59:33 +00:00
422dccc7b0
This doesn't work in PHP 7.2, because 'object' is no longer a valid class name. stdClass works fine. Change-Id: I47375fdf2f36ff62985b2e8c90fa0e5230273984
26 lines
630 B
PHP
26 lines
630 B
PHP
<?php
|
|
|
|
/**
|
|
* @covers HTMLReCaptchaField
|
|
*/
|
|
class HTMLReCaptchaFieldTest extends PHPUnit\Framework\TestCase {
|
|
public function testSubmit() {
|
|
$form = new HTMLForm( [
|
|
'foo' => [
|
|
'class' => HTMLReCaptchaField::class,
|
|
'key' => '123',
|
|
'theme' => 'x',
|
|
],
|
|
] );
|
|
$mockClosure = $this->getMockBuilder( stdClass::class )
|
|
->setMethods( [ '__invoke' ] )->getMock();
|
|
$mockClosure->expects( $this->once() )->method( '__invoke' )
|
|
->with( [] )->willReturn( true );
|
|
|
|
$form->setTitle( Title::newFromText( 'Title' ) );
|
|
$form->setSubmitCallback( $mockClosure );
|
|
$form->prepareForm();
|
|
$form->trySubmit();
|
|
}
|
|
}
|