MediaWiki  1.28.1
RightsLogFormatterTest.php
Go to the documentation of this file.
1 <?php
2 
4 
10  public static function provideRightsLogDatabaseRows() {
11  return [
12  // Current format
13  [
14  [
15  'type' => 'rights',
16  'action' => 'rights',
17  'comment' => 'rights comment',
18  'user' => 0,
19  'user_text' => 'Sysop',
20  'namespace' => NS_USER,
21  'title' => 'User',
22  'params' => [
23  '4::oldgroups' => [],
24  '5::newgroups' => [ 'sysop', 'bureaucrat' ],
25  ],
26  ],
27  [
28  'text' => 'Sysop changed group membership for User from (none) to '
29  . 'administrator and bureaucrat',
30  'api' => [
31  'oldgroups' => [],
32  'newgroups' => [ 'sysop', 'bureaucrat' ],
33  ],
34  ],
35  ],
36 
37  // Legacy format
38  [
39  [
40  'type' => 'rights',
41  'action' => 'rights',
42  'comment' => 'rights comment',
43  'user' => 0,
44  'user_text' => 'Sysop',
45  'namespace' => NS_USER,
46  'title' => 'User',
47  'params' => [
48  '',
49  'sysop, bureaucrat',
50  ],
51  ],
52  [
53  'legacy' => true,
54  'text' => 'Sysop changed group membership for User from (none) to '
55  . 'administrator and bureaucrat',
56  'api' => [
57  'oldgroups' => [],
58  'newgroups' => [ 'sysop', 'bureaucrat' ],
59  ],
60  ],
61  ],
62 
63  // Really old entry
64  [
65  [
66  'type' => 'rights',
67  'action' => 'rights',
68  'comment' => 'rights comment',
69  'user' => 0,
70  'user_text' => 'Sysop',
71  'namespace' => NS_USER,
72  'title' => 'User',
73  'params' => [],
74  ],
75  [
76  'legacy' => true,
77  'text' => 'Sysop changed group membership for User',
78  'api' => [],
79  ],
80  ],
81  ];
82  }
83 
87  public function testRightsLogDatabaseRows( $row, $extra ) {
88  $this->doTestLogFormatter( $row, $extra );
89  }
90 
96  public static function provideAutopromoteLogDatabaseRows() {
97  return [
98  // Current format
99  [
100  [
101  'type' => 'rights',
102  'action' => 'autopromote',
103  'comment' => 'rights comment',
104  'user' => 0,
105  'user_text' => 'Sysop',
106  'namespace' => NS_USER,
107  'title' => 'Sysop',
108  'params' => [
109  '4::oldgroups' => [ 'sysop' ],
110  '5::newgroups' => [ 'sysop', 'bureaucrat' ],
111  ],
112  ],
113  [
114  'text' => 'Sysop was automatically promoted from administrator to '
115  . 'administrator and bureaucrat',
116  'api' => [
117  'oldgroups' => [ 'sysop' ],
118  'newgroups' => [ 'sysop', 'bureaucrat' ],
119  ],
120  ],
121  ],
122 
123  // Legacy format
124  [
125  [
126  'type' => 'rights',
127  'action' => 'autopromote',
128  'comment' => 'rights comment',
129  'user' => 0,
130  'user_text' => 'Sysop',
131  'namespace' => NS_USER,
132  'title' => 'Sysop',
133  'params' => [
134  'sysop',
135  'sysop, bureaucrat',
136  ],
137  ],
138  [
139  'legacy' => true,
140  'text' => 'Sysop was automatically promoted from administrator to '
141  . 'administrator and bureaucrat',
142  'api' => [
143  'oldgroups' => [ 'sysop' ],
144  'newgroups' => [ 'sysop', 'bureaucrat' ],
145  ],
146  ],
147  ],
148  ];
149  }
150 
154  public function testAutopromoteLogDatabaseRows( $row, $extra ) {
155  $this->doTestLogFormatter( $row, $extra );
156  }
157 }
testAutopromoteLogDatabaseRows($row, $extra)
provideAutopromoteLogDatabaseRows
static provideAutopromoteLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility. ...
static provideRightsLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility. ...
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
testRightsLogDatabaseRows($row, $extra)
provideRightsLogDatabaseRows
doTestLogFormatter($row, $extra)