mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
3e3b91b527
Also remove references to "two words" from ReCaptcha labels. The captcha image doesn't always contain two words. Bug: T110302 Change-Id: I544656289480056152a1db195babb6dadf29bc71
30 lines
874 B
PHP
30 lines
874 B
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../ReCaptcha/HTMLSubmittedValueField.php';
|
|
|
|
class HTMLSubmittedValueFieldTest extends PHPUnit_Framework_TestCase {
|
|
public function testSubmit() {
|
|
$form = new HTMLForm( [
|
|
'foo' => [
|
|
'class' => HTMLSubmittedValueField::class,
|
|
'name' => 'bar',
|
|
],
|
|
] );
|
|
$request = new FauxRequest( [
|
|
'foo' => '123',
|
|
'bar' => '456',
|
|
], true );
|
|
$mockClosure = $this->getMockBuilder( 'object' )->setMethods( [ '__invoke' ] )->getMock();
|
|
$mockClosure->expects( $this->once() )->method( '__invoke' )
|
|
->with( [ 'foo' => '456' ] )->willReturn( true );
|
|
|
|
$context = new DerivativeContext( RequestContext::getMain() );
|
|
$context->setRequest( $request );
|
|
$form->setTitle( Title::newFromText( 'Title' ) );
|
|
$form->setContext( $context );
|
|
$form->setSubmitCallback( $mockClosure );
|
|
$form->prepareForm();
|
|
$form->trySubmit();
|
|
}
|
|
}
|