Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6036596
HTMLReCaptchaNoCaptchaFieldTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HTMLReCaptchaNoCaptchaFieldTest.php
View Options
<?php
use
MediaWiki\Context\DerivativeContext
;
use
MediaWiki\Context\RequestContext
;
use
MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha\HTMLReCaptchaNoCaptchaField
;
use
MediaWiki\HTMLForm\HTMLForm
;
use
MediaWiki\Request\FauxRequest
;
use
MediaWiki\Title\Title
;
/**
* @covers \MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha\HTMLReCaptchaNoCaptchaField
*/
class
HTMLReCaptchaNoCaptchaFieldTest
extends
MediaWikiIntegrationTestCase
{
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
mergeMwGlobalArrayValue
(
'wgAutoloadClasses'
,
[
'MediaWiki
\\
Extension
\\
ConfirmEdit
\\
ReCaptchaNoCaptcha
\\
HTMLReCaptchaNoCaptchaField'
=>
__DIR__
.
'/../../ReCaptchaNoCaptcha/includes/HTMLReCaptchaNoCaptchaField.php'
]
);
}
public
function
testSubmit
()
{
$request
=
new
FauxRequest
(
[
'foo'
=>
'abc'
,
'g-recaptcha-response'
=>
'def'
,
],
true
);
$context
=
new
DerivativeContext
(
RequestContext
::
getMain
()
);
$context
->
setRequest
(
$request
);
$form
=
new
HTMLForm
(
[
'foo'
=>
[
'class'
=>
HTMLReCaptchaNoCaptchaField
::
class
,
'key'
=>
'123'
,
],
],
$context
);
$mockClosure
=
$this
->
getMockBuilder
(
stdClass
::
class
)
->
addMethods
(
[
'__invoke'
]
)->
getMock
();
$mockClosure
->
expects
(
$this
->
once
()
)->
method
(
'__invoke'
)
->
with
(
[
'foo'
=>
'def'
]
)->
willReturn
(
true
);
$form
->
setTitle
(
Title
::
newFromText
(
'Title'
)
);
$form
->
setSubmitCallback
(
$mockClosure
);
$form
->
prepareForm
();
$form
->
trySubmit
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 4 2026, 19:29 (5 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1a/cb/99f58a5909f3f263c903a06dee65
Default Alt Text
HTMLReCaptchaNoCaptchaFieldTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment