3 class ProtectLogFormatterTest
extends LogFormatterTestCase
{
6 * Provide different rows from the logging table to test
7 * for backward compatibility.
8 * Do not change the existing data, just add a new database row
10 public static function provideProtectLogDatabaseRows() {
16 'action' => 'protect',
17 'comment' => 'protect comment',
18 'namespace' => NS_MAIN
,
19 'title' => 'ProtectPage',
21 '4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
22 '5:bool:cascade' => false,
27 'expiry' => 'infinity',
33 'expiry' => 'infinity',
40 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
42 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
48 'expiry' => 'infinite',
54 'expiry' => 'infinite',
62 // Current format with cascade
66 'action' => 'protect',
67 'comment' => 'protect comment',
68 'namespace' => NS_MAIN
,
69 'title' => 'ProtectPage',
71 '4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
72 '5:bool:cascade' => true,
77 'expiry' => 'infinity',
83 'expiry' => 'infinity',
90 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
92 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
98 'expiry' => 'infinite',
104 'expiry' => 'infinite',
116 'action' => 'protect',
117 'comment' => 'protect comment',
118 'namespace' => NS_MAIN
,
119 'title' => 'ProtectPage',
121 '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
127 'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
129 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
135 // Legacy format with cascade
139 'action' => 'protect',
140 'comment' => 'protect comment',
141 'namespace' => NS_MAIN
,
142 'title' => 'ProtectPage',
144 '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
150 'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
152 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
162 * @dataProvider provideProtectLogDatabaseRows
164 public function testProtectLogDatabaseRows( $row, $extra ) {
165 $this->doTestLogFormatter( $row, $extra );
169 * Provide different rows from the logging table to test
170 * for backward compatibility.
171 * Do not change the existing data, just add a new database row
173 public static function provideModifyLogDatabaseRows() {
179 'action' => 'modify',
180 'comment' => 'protect comment',
181 'namespace' => NS_MAIN
,
182 'title' => 'ProtectPage',
184 '4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
185 '5:bool:cascade' => false,
190 'expiry' => 'infinity',
196 'expiry' => 'infinity',
203 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
205 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
211 'expiry' => 'infinite',
217 'expiry' => 'infinite',
225 // Current format with cascade
229 'action' => 'modify',
230 'comment' => 'protect comment',
231 'namespace' => NS_MAIN
,
232 'title' => 'ProtectPage',
234 '4::description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
235 '5:bool:cascade' => true,
240 'expiry' => 'infinity',
246 'expiry' => 'infinity',
253 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
255 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
261 'expiry' => 'infinite',
267 'expiry' => 'infinite',
279 'action' => 'modify',
280 'comment' => 'protect comment',
281 'namespace' => NS_MAIN
,
282 'title' => 'ProtectPage',
284 '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
290 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
292 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
298 // Legacy format with cascade
302 'action' => 'modify',
303 'comment' => 'protect comment',
304 'namespace' => NS_MAIN
,
305 'title' => 'ProtectPage',
307 '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
313 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
315 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
325 * @dataProvider provideModifyLogDatabaseRows
327 public function testModifyLogDatabaseRows( $row, $extra ) {
328 $this->doTestLogFormatter( $row, $extra );
332 * Provide different rows from the logging table to test
333 * for backward compatibility.
334 * Do not change the existing data, just add a new database row
336 public static function provideUnprotectLogDatabaseRows() {
342 'action' => 'unprotect',
343 'comment' => 'unprotect comment',
344 'namespace' => NS_MAIN
,
345 'title' => 'ProtectPage',
349 'text' => 'User removed protection from ProtectPage',
358 * @dataProvider provideUnprotectLogDatabaseRows
360 public function testUnprotectLogDatabaseRows( $row, $extra ) {
361 $this->doTestLogFormatter( $row, $extra );
365 * Provide different rows from the logging table to test
366 * for backward compatibility.
367 * Do not change the existing data, just add a new database row
369 public static function provideMoveProtLogDatabaseRows() {
375 'action' => 'move_prot',
376 'comment' => 'Move comment',
377 'namespace' => NS_MAIN
,
378 'title' => 'NewPage',
380 '4::oldtitle' => 'OldPage',
384 'text' => 'User moved protection settings from OldPage to NewPage',
387 'oldtitle_title' => 'OldPage',
396 'action' => 'move_prot',
397 'comment' => 'Move comment',
398 'namespace' => NS_MAIN
,
399 'title' => 'NewPage',
406 'text' => 'User moved protection settings from OldPage to NewPage',
409 'oldtitle_title' => 'OldPage',
417 * @dataProvider provideMoveProtLogDatabaseRows
419 public function testMoveProtLogDatabaseRows( $row, $extra ) {
420 $this->doTestLogFormatter( $row, $extra );