Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4129178
ChangesListFilterTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ChangesListFilterTest.php
View Options
<?php
use
Wikimedia\TestingAccessWrapper
;
/**
* @covers \ChangesListFilter
*/
class
ChangesListFilterTest
extends
MediaWikiUnitTestCase
{
/** @var MockChangesListFilterGroup */
private
$group
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
group
=
$this
->
getGroup
(
[
'name'
=>
'group'
]
);
}
protected
function
getGroup
(
$groupDefinition
)
{
return
new
MockChangesListFilterGroup
(
$groupDefinition
+
[
'isFullCoverage'
=>
true
,
'type'
=>
'some_type'
,
'name'
=>
'group'
,
'filters'
=>
[],
]
);
}
public
function
testReservedCharacter
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
"Filter names may not contain '_'. Use the naming convention: 'lowercase'"
);
new
MockChangesListFilter
(
[
'group'
=>
$this
->
group
,
'name'
=>
'some_name'
,
'priority'
=>
1
,
]
);
}
public
function
testDuplicateName
()
{
new
MockChangesListFilter
(
[
'group'
=>
$this
->
group
,
'name'
=>
'somename'
,
'priority'
=>
1
,
]
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
"Two filters in a group cannot have the same name: 'somename'"
);
new
MockChangesListFilter
(
[
'group'
=>
$this
->
group
,
'name'
=>
'somename'
,
'priority'
=>
2
,
]
);
}
public
function
testSetAsSupersetOf
()
{
$groupA
=
$this
->
getGroup
(
[
'name'
=>
'groupA'
,
'filters'
=>
[
[
'name'
=>
'foo'
,
],
[
'name'
=>
'bar'
,
]
],
]
);
$groupB
=
$this
->
getGroup
(
[
'name'
=>
'groupB'
,
'filters'
=>
[
[
'name'
=>
'baz'
,
],
],
]
);
$foo
=
TestingAccessWrapper
::
newFromObject
(
$groupA
->
getFilter
(
'foo'
)
);
$bar
=
$groupA
->
getFilter
(
'bar'
);
$baz
=
$groupB
->
getFilter
(
'baz'
);
$foo
->
setAsSupersetOf
(
$bar
);
$this
->
assertArrayEquals
(
[
[
'group'
=>
'groupA'
,
'filter'
=>
'bar'
,
],
],
$foo
->
subsetFilters
,
/** ordered= */
false
,
/** named= */
true
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
"Supersets can only be defined for filters in the same group"
);
$foo
->
setAsSupersetOf
(
$baz
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 09:39 (2 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8c/1d/b155582706d7f3ea831442a0fa94
Default Alt Text
ChangesListFilterTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment