Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4058136
FilterFactoryProxyTrait.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
FilterFactoryProxyTrait.php
View Options
<?php
namespace
MediaWiki\CheckUser\Tests\Integration\AbuseFilter
;
use
MediaWiki\Extension\AbuseFilter\Filter\Filter
;
use
MediaWiki\Extension\AbuseFilter\Tests\Integration\FilterFromSpecsTestTrait
;
use
TestUser
;
use
TestUserRegistry
;
use
Wikimedia\Rdbms\IDatabase
;
trait
FilterFactoryProxyTrait
{
/**
* Returns a factory class that wraps a call to getFilterFromSpecs() from
* the FilterFromSpecsTestTrait provided by AbuseFilter, therefore acting as
* a proxy for the original trait.
*
* A factory class is used instead of applying the method directly to the
* test case class since, when applied to the test class directly, it will
* fail to load unless AbuseFilter is available in the extension directory
* AND loaded in LocalSettings.php.
*
* The anonymous class returned by this method allows for calling the
* private method from the trait, while allowing for not trying to load the
* trait at all if AbuseFilter is not loaded.
*/
private
function
getFilterFactoryProxy
():
object
{
return
new
class
(
$this
->
getDb
()
)
{
use
FilterFromSpecsTestTrait
;
private
IDatabase
$dbw
;
public
function
__construct
(
IDatabase
$dbw
)
{
$this
->
dbw
=
$dbw
;
}
public
function
getFilter
(
array
$specs
):
Filter
{
return
$this
->
getFilterFromSpecs
(
$specs
);
}
protected
function
getDb
():
IDatabase
{
return
$this
->
dbw
;
}
/**
* @param array $groups Groups the test user belongs to
*/
protected
function
getTestUser
(
$groups
=
[]
):
TestUser
{
return
TestUserRegistry
::
getImmutableTestUser
(
$groups
);
}
};
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 16 2026, 04:32 (12 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9e/12/6322cb3b4b8894195e96241c8883
Default Alt Text
FilterFactoryProxyTrait.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment