MediaWiki REL1_31
ChangesListBooleanFilterGroupTest.php
Go to the documentation of this file.
1<?php
2
3use Wikimedia\TestingAccessWrapper;
4
9 public function testIsFullCoverage() {
10 $hideGroupDefault = TestingAccessWrapper::newFromObject(
12 'name' => 'groupName',
13 'priority' => 1,
14 'filters' => [],
15 ] )
16 );
17
18 $this->assertSame(
19 true,
20 $hideGroupDefault->isFullCoverage
21 );
22 }
23
24 public function testGetJsData() {
25 $definition = [
26 'name' => 'some-group',
27 'title' => 'some-group-title',
28 'priority' => 1,
29 'filters' => [
30 [
31 'name' => 'hidefoo',
32 'label' => 'foo-label',
33 'description' => 'foo-description',
34 'default' => true,
35 'showHide' => 'showhidefoo',
36 'priority' => 2,
37 ],
38 [
39 'name' => 'hidebar',
40 'label' => 'bar-label',
41 'description' => 'bar-description',
42 'default' => false,
43 'priority' => 4,
44 ]
45 ],
46 ];
47
48 $group = new ChangesListBooleanFilterGroup( $definition );
49
50 $this->assertArrayEquals(
51 [
52 'name' => 'some-group',
53 'title' => 'some-group-title',
55 'priority' => 1,
56 'filters' => [
57 [
58 'name' => 'hidebar',
59 'label' => 'bar-label',
60 'description' => 'bar-description',
61 'default' => false,
62 'priority' => 4,
63 'cssClass' => null,
64 'conflicts' => [],
65 'subset' => [],
66 'defaultHighlightColor' => null,
67 ],
68 [
69 'name' => 'hidefoo',
70 'label' => 'foo-label',
71 'description' => 'foo-description',
72 'default' => true,
73 'priority' => 2,
74 'cssClass' => null,
75 'conflicts' => [],
76 'subset' => [],
77 'defaultHighlightColor' => null,
78 ],
79 ],
80 'conflicts' => [],
81 'fullCoverage' => true,
82 'messageKeys' => [
83 'some-group-title',
84 'bar-label',
85 'bar-description',
86 'foo-label',
87 'foo-description',
88 ],
89 ],
90
91 $group->getJsData(),
92 false,
93 true
94 );
95 }
96}
If the group is active, any unchecked filters will translate to hide parameters in the URL.
const TYPE
Type marker, used by JavaScript.
assertArrayEquals(array $expected, array $actual, $ordered=false, $named=false)
Assert that two arrays are equal.