MediaWiki REL1_32
MoveLogFormatterTest.php
Go to the documentation of this file.
1<?php
2
7
13 public static function provideMoveLogDatabaseRows() {
14 return [
15 // Current format - with redirect
16 [
17 [
18 'type' => 'move',
19 'action' => 'move',
20 'comment' => 'move comment with redirect',
21 'namespace' => NS_MAIN,
22 'title' => 'OldPage',
23 'params' => [
24 '4::target' => 'NewPage',
25 '5::noredir' => '0',
26 ],
27 ],
28 [
29 'text' => 'User moved page OldPage to NewPage',
30 'api' => [
31 'target_ns' => 0,
32 'target_title' => 'NewPage',
33 'suppressredirect' => false,
34 ],
35 ],
36 ],
37
38 // Current format - without redirect
39 [
40 [
41 'type' => 'move',
42 'action' => 'move',
43 'comment' => 'move comment',
44 'namespace' => NS_MAIN,
45 'title' => 'OldPage',
46 'params' => [
47 '4::target' => 'NewPage',
48 '5::noredir' => '1',
49 ],
50 ],
51 [
52 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
53 'api' => [
54 'target_ns' => 0,
55 'target_title' => 'NewPage',
56 'suppressredirect' => true,
57 ],
58 ],
59 ],
60
61 // legacy format - with redirect
62 [
63 [
64 'type' => 'move',
65 'action' => 'move',
66 'comment' => 'move comment',
67 'namespace' => NS_MAIN,
68 'title' => 'OldPage',
69 'params' => [
70 'NewPage',
71 '',
72 ],
73 ],
74 [
75 'legacy' => true,
76 'text' => 'User moved page OldPage to NewPage',
77 'api' => [
78 'target_ns' => 0,
79 'target_title' => 'NewPage',
80 'suppressredirect' => false,
81 ],
82 ],
83 ],
84
85 // legacy format - without redirect
86 [
87 [
88 'type' => 'move',
89 'action' => 'move',
90 'comment' => 'move comment',
91 'namespace' => NS_MAIN,
92 'title' => 'OldPage',
93 'params' => [
94 'NewPage',
95 '1',
96 ],
97 ],
98 [
99 'legacy' => true,
100 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
101 'api' => [
102 'target_ns' => 0,
103 'target_title' => 'NewPage',
104 'suppressredirect' => true,
105 ],
106 ],
107 ],
108
109 // old format without flag for redirect suppression
110 [
111 [
112 'type' => 'move',
113 'action' => 'move',
114 'comment' => 'move comment',
115 'namespace' => NS_MAIN,
116 'title' => 'OldPage',
117 'params' => [
118 'NewPage',
119 ],
120 ],
121 [
122 'legacy' => true,
123 'text' => 'User moved page OldPage to NewPage',
124 'api' => [
125 'target_ns' => 0,
126 'target_title' => 'NewPage',
127 'suppressredirect' => false,
128 ],
129 ],
130 ],
131 ];
132 }
133
137 public function testMoveLogDatabaseRows( $row, $extra ) {
138 $this->doTestLogFormatter( $row, $extra );
139 }
140
146 public static function provideMoveRedirLogDatabaseRows() {
147 return [
148 // Current format - with redirect
149 [
150 [
151 'type' => 'move',
152 'action' => 'move_redir',
153 'comment' => 'move comment with redirect',
154 'namespace' => NS_MAIN,
155 'title' => 'OldPage',
156 'params' => [
157 '4::target' => 'NewPage',
158 '5::noredir' => '0',
159 ],
160 ],
161 [
162 'text' => 'User moved page OldPage to NewPage over redirect',
163 'api' => [
164 'target_ns' => 0,
165 'target_title' => 'NewPage',
166 'suppressredirect' => false,
167 ],
168 ],
169 ],
170
171 // Current format - without redirect
172 [
173 [
174 'type' => 'move',
175 'action' => 'move_redir',
176 'comment' => 'move comment',
177 'namespace' => NS_MAIN,
178 'title' => 'OldPage',
179 'params' => [
180 '4::target' => 'NewPage',
181 '5::noredir' => '1',
182 ],
183 ],
184 [
185 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
186 'api' => [
187 'target_ns' => 0,
188 'target_title' => 'NewPage',
189 'suppressredirect' => true,
190 ],
191 ],
192 ],
193
194 // legacy format - with redirect
195 [
196 [
197 'type' => 'move',
198 'action' => 'move_redir',
199 'comment' => 'move comment',
200 'namespace' => NS_MAIN,
201 'title' => 'OldPage',
202 'params' => [
203 'NewPage',
204 '',
205 ],
206 ],
207 [
208 'legacy' => true,
209 'text' => 'User moved page OldPage to NewPage over redirect',
210 'api' => [
211 'target_ns' => 0,
212 'target_title' => 'NewPage',
213 'suppressredirect' => false,
214 ],
215 ],
216 ],
217
218 // legacy format - without redirect
219 [
220 [
221 'type' => 'move',
222 'action' => 'move_redir',
223 'comment' => 'move comment',
224 'namespace' => NS_MAIN,
225 'title' => 'OldPage',
226 'params' => [
227 'NewPage',
228 '1',
229 ],
230 ],
231 [
232 'legacy' => true,
233 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
234 'api' => [
235 'target_ns' => 0,
236 'target_title' => 'NewPage',
237 'suppressredirect' => true,
238 ],
239 ],
240 ],
241
242 // old format without flag for redirect suppression
243 [
244 [
245 'type' => 'move',
246 'action' => 'move_redir',
247 'comment' => 'move comment',
248 'namespace' => NS_MAIN,
249 'title' => 'OldPage',
250 'params' => [
251 'NewPage',
252 ],
253 ],
254 [
255 'legacy' => true,
256 'text' => 'User moved page OldPage to NewPage over redirect',
257 'api' => [
258 'target_ns' => 0,
259 'target_title' => 'NewPage',
260 'suppressredirect' => false,
261 ],
262 ],
263 ],
264 ];
265 }
266
270 public function testMoveRedirLogDatabaseRows( $row, $extra ) {
271 $this->doTestLogFormatter( $row, $extra );
272 }
273}
doTestLogFormatter( $row, $extra)
static provideMoveRedirLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility.
testMoveLogDatabaseRows( $row, $extra)
provideMoveLogDatabaseRows
testMoveRedirLogDatabaseRows( $row, $extra)
provideMoveRedirLogDatabaseRows
static provideMoveLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility.
const NS_MAIN
Definition Defines.php:64
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:37