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