2016-05-03 16:42:00 +00:00
|
|
|
<?php
|
|
|
|
|
2018-01-23 23:59:08 +00:00
|
|
|
/**
|
|
|
|
* @covers HTMLReCaptchaField
|
|
|
|
*/
|
2018-02-15 09:34:50 +00:00
|
|
|
class HTMLReCaptchaFieldTest extends PHPUnit\Framework\TestCase {
|
2016-05-03 16:42:00 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|