Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / logging / DeleteLogFormatterTest.php
blob3fb4eabff1f28fe779db0692279aff5690c0d129
1 <?php
3 class DeleteLogFormatterTest extends LogFormatterTestCase {
5 /**
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
9 */
10 public static function provideDeleteLogDatabaseRows() {
11 return [
12 // Current format
15 'type' => 'delete',
16 'action' => 'delete',
17 'comment' => 'delete comment',
18 'namespace' => NS_MAIN,
19 'title' => 'Page',
20 'params' => [],
23 'text' => 'User deleted page Page',
24 'api' => [],
28 // Legacy format
31 'type' => 'delete',
32 'action' => 'delete',
33 'comment' => 'delete comment',
34 'namespace' => NS_MAIN,
35 'title' => 'Page',
36 'params' => [],
39 'legacy' => true,
40 'text' => 'User deleted page Page',
41 'api' => [],
47 /**
48 * @dataProvider provideDeleteLogDatabaseRows
50 public function testDeleteLogDatabaseRows( $row, $extra ) {
51 $this->doTestLogFormatter( $row, $extra );
54 /**
55 * Provide different rows from the logging table to test
56 * for backward compatibility.
57 * Do not change the existing data, just add a new database row
59 public static function provideRestoreLogDatabaseRows() {
60 return [
61 // Current format
64 'type' => 'delete',
65 'action' => 'restore',
66 'comment' => 'delete comment',
67 'namespace' => NS_MAIN,
68 'title' => 'Page',
69 'params' => [],
72 'text' => 'User restored page Page',
73 'api' => [],
77 // Legacy format
80 'type' => 'delete',
81 'action' => 'restore',
82 'comment' => 'delete comment',
83 'namespace' => NS_MAIN,
84 'title' => 'Page',
85 'params' => [],
88 'legacy' => true,
89 'text' => 'User restored page Page',
90 'api' => [],
96 /**
97 * @dataProvider provideRestoreLogDatabaseRows
99 public function testRestoreLogDatabaseRows( $row, $extra ) {
100 $this->doTestLogFormatter( $row, $extra );
104 * Provide different rows from the logging table to test
105 * for backward compatibility.
106 * Do not change the existing data, just add a new database row
108 public static function provideRevisionLogDatabaseRows() {
109 return [
110 // Current format
113 'type' => 'delete',
114 'action' => 'revision',
115 'comment' => 'delete comment',
116 'namespace' => NS_MAIN,
117 'title' => 'Page',
118 'params' => [
119 '4::type' => 'archive',
120 '5::ids' => [ '1', '3', '4' ],
121 '6::ofield' => '1',
122 '7::nfield' => '2',
126 'text' => 'User changed visibility of 3 revisions on page Page: edit summary '
127 . 'hidden and content unhidden',
128 'api' => [
129 'type' => 'archive',
130 'ids' => [ '1', '3', '4' ],
131 'old' => [
132 'bitmask' => 1,
133 'content' => true,
134 'comment' => false,
135 'user' => false,
136 'restricted' => false,
138 'new' => [
139 'bitmask' => 2,
140 'content' => false,
141 'comment' => true,
142 'user' => false,
143 'restricted' => false,
149 // Legacy format
152 'type' => 'delete',
153 'action' => 'revision',
154 'comment' => 'delete comment',
155 'namespace' => NS_MAIN,
156 'title' => 'Page',
157 'params' => [
158 'archive',
159 '1,3,4',
160 'ofield=1',
161 'nfield=2',
165 'legacy' => true,
166 'text' => 'User changed visibility of 3 revisions on page Page: edit summary '
167 . 'hidden and content unhidden',
168 'api' => [
169 'type' => 'archive',
170 'ids' => [ '1', '3', '4' ],
171 'old' => [
172 'bitmask' => 1,
173 'content' => true,
174 'comment' => false,
175 'user' => false,
176 'restricted' => false,
178 'new' => [
179 'bitmask' => 2,
180 'content' => false,
181 'comment' => true,
182 'user' => false,
183 'restricted' => false,
192 * @dataProvider provideRevisionLogDatabaseRows
194 public function testRevisionLogDatabaseRows( $row, $extra ) {
195 $this->doTestLogFormatter( $row, $extra );
199 * Provide different rows from the logging table to test
200 * for backward compatibility.
201 * Do not change the existing data, just add a new database row
203 public static function provideEventLogDatabaseRows() {
204 return [
205 // Current format
208 'type' => 'delete',
209 'action' => 'event',
210 'comment' => 'delete comment',
211 'namespace' => NS_MAIN,
212 'title' => 'Page',
213 'params' => [
214 '4::ids' => [ '1', '3', '4' ],
215 '5::ofield' => '1',
216 '6::nfield' => '2',
220 'text' => 'User changed visibility of 3 log events on Page: edit summary hidden '
221 . 'and content unhidden',
222 'api' => [
223 'type' => 'logging',
224 'ids' => [ '1', '3', '4' ],
225 'old' => [
226 'bitmask' => 1,
227 'content' => true,
228 'comment' => false,
229 'user' => false,
230 'restricted' => false,
232 'new' => [
233 'bitmask' => 2,
234 'content' => false,
235 'comment' => true,
236 'user' => false,
237 'restricted' => false,
243 // Legacy format
246 'type' => 'delete',
247 'action' => 'event',
248 'comment' => 'delete comment',
249 'namespace' => NS_MAIN,
250 'title' => 'Page',
251 'params' => [
252 '1,3,4',
253 'ofield=1',
254 'nfield=2',
258 'legacy' => true,
259 'text' => 'User changed visibility of 3 log events on Page: edit summary hidden '
260 . 'and content unhidden',
261 'api' => [
262 'type' => 'logging',
263 'ids' => [ '1', '3', '4' ],
264 'old' => [
265 'bitmask' => 1,
266 'content' => true,
267 'comment' => false,
268 'user' => false,
269 'restricted' => false,
271 'new' => [
272 'bitmask' => 2,
273 'content' => false,
274 'comment' => true,
275 'user' => false,
276 'restricted' => false,
285 * @dataProvider provideEventLogDatabaseRows
287 public function testEventLogDatabaseRows( $row, $extra ) {
288 $this->doTestLogFormatter( $row, $extra );
292 * Provide different rows from the logging table to test
293 * for backward compatibility.
294 * Do not change the existing data, just add a new database row
296 public static function provideSuppressRevisionLogDatabaseRows() {
297 return [
298 // Current format
301 'type' => 'suppress',
302 'action' => 'revision',
303 'comment' => 'Suppress comment',
304 'namespace' => NS_MAIN,
305 'title' => 'Page',
306 'params' => [
307 '4::type' => 'archive',
308 '5::ids' => [ '1', '3', '4' ],
309 '6::ofield' => '1',
310 '7::nfield' => '10',
314 'text' => 'User secretly changed visibility of 3 revisions on page Page: edit '
315 . 'summary hidden, content unhidden and applied restrictions to administrators',
316 'api' => [
317 'type' => 'archive',
318 'ids' => [ '1', '3', '4' ],
319 'old' => [
320 'bitmask' => 1,
321 'content' => true,
322 'comment' => false,
323 'user' => false,
324 'restricted' => false,
326 'new' => [
327 'bitmask' => 10,
328 'content' => false,
329 'comment' => true,
330 'user' => false,
331 'restricted' => true,
337 // Legacy format
340 'type' => 'suppress',
341 'action' => 'revision',
342 'comment' => 'Suppress comment',
343 'namespace' => NS_MAIN,
344 'title' => 'Page',
345 'params' => [
346 'archive',
347 '1,3,4',
348 'ofield=1',
349 'nfield=10',
353 'legacy' => true,
354 'text' => 'User secretly changed visibility of 3 revisions on page Page: edit '
355 . 'summary hidden, content unhidden and applied restrictions to administrators',
356 'api' => [
357 'type' => 'archive',
358 'ids' => [ '1', '3', '4' ],
359 'old' => [
360 'bitmask' => 1,
361 'content' => true,
362 'comment' => false,
363 'user' => false,
364 'restricted' => false,
366 'new' => [
367 'bitmask' => 10,
368 'content' => false,
369 'comment' => true,
370 'user' => false,
371 'restricted' => true,
380 * @dataProvider provideSuppressRevisionLogDatabaseRows
382 public function testSuppressRevisionLogDatabaseRows( $row, $extra ) {
383 $this->doTestLogFormatter( $row, $extra );
387 * Provide different rows from the logging table to test
388 * for backward compatibility.
389 * Do not change the existing data, just add a new database row
391 public static function provideSuppressEventLogDatabaseRows() {
392 return [
393 // Current format
396 'type' => 'suppress',
397 'action' => 'event',
398 'comment' => 'Suppress comment',
399 'namespace' => NS_MAIN,
400 'title' => 'Page',
401 'params' => [
402 '4::ids' => [ '1', '3', '4' ],
403 '5::ofield' => '1',
404 '6::nfield' => '10',
408 'text' => 'User secretly changed visibility of 3 log events on Page: edit '
409 . 'summary hidden, content unhidden and applied restrictions to administrators',
410 'api' => [
411 'type' => 'logging',
412 'ids' => [ '1', '3', '4' ],
413 'old' => [
414 'bitmask' => 1,
415 'content' => true,
416 'comment' => false,
417 'user' => false,
418 'restricted' => false,
420 'new' => [
421 'bitmask' => 10,
422 'content' => false,
423 'comment' => true,
424 'user' => false,
425 'restricted' => true,
431 // Legacy format
434 'type' => 'suppress',
435 'action' => 'event',
436 'comment' => 'Suppress comment',
437 'namespace' => NS_MAIN,
438 'title' => 'Page',
439 'params' => [
440 '1,3,4',
441 'ofield=1',
442 'nfield=10',
446 'legacy' => true,
447 'text' => 'User secretly changed visibility of 3 log events on Page: edit '
448 . 'summary hidden, content unhidden and applied restrictions to administrators',
449 'api' => [
450 'type' => 'logging',
451 'ids' => [ '1', '3', '4' ],
452 'old' => [
453 'bitmask' => 1,
454 'content' => true,
455 'comment' => false,
456 'user' => false,
457 'restricted' => false,
459 'new' => [
460 'bitmask' => 10,
461 'content' => false,
462 'comment' => true,
463 'user' => false,
464 'restricted' => true,
473 * @dataProvider provideSuppressEventLogDatabaseRows
475 public function testSuppressEventLogDatabaseRows( $row, $extra ) {
476 $this->doTestLogFormatter( $row, $extra );
480 * Provide different rows from the logging table to test
481 * for backward compatibility.
482 * Do not change the existing data, just add a new database row
484 public static function provideSuppressDeleteLogDatabaseRows() {
485 return [
486 // Current format
489 'type' => 'suppress',
490 'action' => 'delete',
491 'comment' => 'delete comment',
492 'namespace' => NS_MAIN,
493 'title' => 'Page',
494 'params' => [],
497 'text' => 'User suppressed page Page',
498 'api' => [],
502 // Legacy format
505 'type' => 'suppress',
506 'action' => 'delete',
507 'comment' => 'delete comment',
508 'namespace' => NS_MAIN,
509 'title' => 'Page',
510 'params' => [],
513 'legacy' => true,
514 'text' => 'User suppressed page Page',
515 'api' => [],
522 * @dataProvider provideSuppressDeleteLogDatabaseRows
524 public function testSuppressDeleteLogDatabaseRows( $row, $extra ) {
525 $this->doTestLogFormatter( $row, $extra );