MediaWiki  1.33.0
ChangesListBooleanFilterGroupTest.php
Go to the documentation of this file.
1 <?php
2 
3 use 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(), false, true
94  );
95  }
96 }
MediaWikiTestCase\assertArrayEquals
assertArrayEquals(array $expected, array $actual, $ordered=false, $named=false)
Assert that two arrays are equal.
Definition: MediaWikiTestCase.php:2070
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
ChangesListBooleanFilterGroupTest
ChangesListBooleanFilterGroup.
Definition: ChangesListBooleanFilterGroupTest.php:8
ChangesListBooleanFilterGroupTest\testIsFullCoverage
testIsFullCoverage()
Definition: ChangesListBooleanFilterGroupTest.php:9
ChangesListBooleanFilterGroup
If the group is active, any unchecked filters will translate to hide parameters in the URL.
Definition: ChangesListBooleanFilterGroup.php:12
ChangesListBooleanFilterGroupTest\testGetJsData
testGetJsData()
Definition: ChangesListBooleanFilterGroupTest.php:24
true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1985
ChangesListBooleanFilterGroup\TYPE
const TYPE
Type marker, used by JavaScript.
Definition: ChangesListBooleanFilterGroup.php:16