Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5978508
ChangesListBooleanFilterTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
ChangesListBooleanFilterTest.php
View Options
<?php
/**
* @covers \ChangesListBooleanFilter
*/
class
ChangesListBooleanFilterTest
extends
MediaWikiUnitTestCase
{
public
function
testGetJsData
()
{
$group
=
new
ChangesListBooleanFilterGroup
(
[
'name'
=>
'group'
,
'priority'
=>
2
,
'filters'
=>
[],
]
);
$definition
=
[
'group'
=>
$group
,
'label'
=>
'main-label'
,
'description'
=>
'main-description'
,
'default'
=>
1
,
'priority'
=>
1
,
];
$fooFilter
=
new
ChangesListBooleanFilter
(
$definition
+
[
'name'
=>
'hidefoo'
]
);
$barFilter
=
new
ChangesListBooleanFilter
(
$definition
+
[
'name'
=>
'hidebar'
]
);
$bazFilter
=
new
ChangesListBooleanFilter
(
$definition
+
[
'name'
=>
'hidebaz'
]
);
$fooFilter
->
conflictsWith
(
$barFilter
,
'foo-bar-global-conflict'
,
'foo-conflicts-bar'
,
'bar-conflicts-foo'
);
$fooFilter
->
setAsSupersetOf
(
$bazFilter
,
'foo-superset-of-baz'
);
$fooData
=
$fooFilter
->
getJsData
();
$this
->
assertArrayEquals
(
[
'name'
=>
'hidefoo'
,
'label'
=>
'main-label'
,
'description'
=>
'main-description'
,
'default'
=>
1
,
'priority'
=>
1
,
'cssClass'
=>
null
,
'defaultHighlightColor'
=>
null
,
'conflicts'
=>
[
[
'group'
=>
'group'
,
'filter'
=>
'hidebar'
,
'globalDescription'
=>
'foo-bar-global-conflict'
,
'contextDescription'
=>
'foo-conflicts-bar'
,
]
],
'subset'
=>
[
[
'group'
=>
'group'
,
'filter'
=>
'hidebaz'
,
],
],
'messageKeys'
=>
[
'main-label'
,
'main-description'
,
'foo-bar-global-conflict'
,
'foo-conflicts-bar'
,
],
],
$fooData
,
/** ordered= */
false
,
/** named= */
true
);
$barData
=
$barFilter
->
getJsData
();
$this
->
assertArrayEquals
(
[
'name'
=>
'hidebar'
,
'label'
=>
'main-label'
,
'description'
=>
'main-description'
,
'default'
=>
1
,
'priority'
=>
1
,
'cssClass'
=>
null
,
'defaultHighlightColor'
=>
null
,
'conflicts'
=>
[
[
'group'
=>
'group'
,
'filter'
=>
'hidefoo'
,
'globalDescription'
=>
'foo-bar-global-conflict'
,
'contextDescription'
=>
'bar-conflicts-foo'
,
]
],
'subset'
=>
[],
'messageKeys'
=>
[
'main-label'
,
'main-description'
,
'foo-bar-global-conflict'
,
'bar-conflicts-foo'
,
],
],
$barData
,
/** ordered= */
false
,
/** named= */
true
);
}
public
function
testIsFeatureAvailableOnStructuredUi
()
{
$groupA
=
new
ChangesListBooleanFilterGroup
(
[
'name'
=>
'groupA'
,
'priority'
=>
1
,
'filters'
=>
[],
]
);
$foo
=
new
ChangesListBooleanFilter
(
[
'name'
=>
'hidefoo'
,
'group'
=>
$groupA
,
'label'
=>
'foo-label'
,
'description'
=>
'foo-description'
,
'default'
=>
true
,
'showHide'
=>
'showhidefoo'
,
'priority'
=>
2
,
]
);
$this
->
assertTrue
(
$foo
->
isFeatureAvailableOnStructuredUi
(),
'Same filter appears on both'
);
// Should only be legacy ones that haven't been ported yet
$bar
=
new
ChangesListBooleanFilter
(
[
'name'
=>
'hidebar'
,
'default'
=>
true
,
'group'
=>
$groupA
,
'showHide'
=>
'showhidebar'
,
'priority'
=>
2
,
]
);
$this
->
assertFalse
(
$bar
->
isFeatureAvailableOnStructuredUi
(),
'Only on unstructured UI'
);
$baz
=
new
ChangesListBooleanFilter
(
[
'name'
=>
'hidebaz'
,
'default'
=>
true
,
'group'
=>
$groupA
,
'showHide'
=>
'showhidebaz'
,
'isReplacedInStructuredUi'
=>
true
,
'priority'
=>
2
,
]
);
$this
->
assertTrue
(
$baz
->
isFeatureAvailableOnStructuredUi
(),
'Legacy filter does not appear directly in new UI, but equivalent '
.
'does and is marked with isReplacedInStructuredUi'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:26 (3 d, 22 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c9/21/0b9ed4a9df97143cde8e7e291fe6
Default Alt Text
ChangesListBooleanFilterTest.php (3 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment