Merge "Change php extract() to explicit code"
[lhc/web/wiklou.git] / tests / phpunit / includes / logging / PatrolLogFormatterTest.php
1 <?php
2
3 /**
4 * @covers PatrolLogFormatter
5 */
6 class PatrolLogFormatterTest extends LogFormatterTestCase {
7
8 /**
9 * Provide different rows from the logging table to test
10 * for backward compatibility.
11 * Do not change the existing data, just add a new database row
12 */
13 public static function providePatrolLogDatabaseRows() {
14 return [
15 // Current format
16 [
17 [
18 'type' => 'patrol',
19 'action' => 'patrol',
20 'comment' => 'patrol comment',
21 'namespace' => NS_MAIN,
22 'title' => 'Page',
23 'params' => [
24 '4::curid' => 2,
25 '5::previd' => 1,
26 '6::auto' => 0,
27 ],
28 ],
29 [
30 'text' => 'User marked revision 2 of page Page patrolled',
31 'api' => [
32 'curid' => 2,
33 'previd' => 1,
34 'auto' => false,
35 ],
36 ],
37 ],
38
39 // Current format - autopatrol
40 [
41 [
42 'type' => 'patrol',
43 'action' => 'patrol',
44 'comment' => 'patrol comment',
45 'namespace' => NS_MAIN,
46 'title' => 'Page',
47 'params' => [
48 '4::curid' => 2,
49 '5::previd' => 1,
50 '6::auto' => 1,
51 ],
52 ],
53 [
54 'text' => 'User automatically marked revision 2 of page Page patrolled',
55 'api' => [
56 'curid' => 2,
57 'previd' => 1,
58 'auto' => true,
59 ],
60 ],
61 ],
62
63 // Legacy format
64 [
65 [
66 'type' => 'patrol',
67 'action' => 'patrol',
68 'comment' => 'patrol comment',
69 'namespace' => NS_MAIN,
70 'title' => 'Page',
71 'params' => [
72 '2',
73 '1',
74 '0',
75 ],
76 ],
77 [
78 'legacy' => true,
79 'text' => 'User marked revision 2 of page Page patrolled',
80 'api' => [
81 'curid' => 2,
82 'previd' => 1,
83 'auto' => false,
84 ],
85 ],
86 ],
87
88 // Legacy format - autopatrol
89 [
90 [
91 'type' => 'patrol',
92 'action' => 'patrol',
93 'comment' => 'patrol comment',
94 'namespace' => NS_MAIN,
95 'title' => 'Page',
96 'params' => [
97 '2',
98 '1',
99 '1',
100 ],
101 ],
102 [
103 'legacy' => true,
104 'text' => 'User automatically marked revision 2 of page Page patrolled',
105 'api' => [
106 'curid' => 2,
107 'previd' => 1,
108 'auto' => true,
109 ],
110 ],
111 ],
112 ];
113 }
114
115 /**
116 * @dataProvider providePatrolLogDatabaseRows
117 */
118 public function testPatrolLogDatabaseRows( $row, $extra ) {
119 $this->doTestLogFormatter( $row, $extra );
120 }
121 }