Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / logging / RightsLogFormatterTest.php
bloba81e7ec30b39d4b2b1ef264124e32fd380b370d7
1 <?php
3 class RightsLogFormatterTest 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 provideRightsLogDatabaseRows() {
11 return [
12 // Current format
15 'type' => 'rights',
16 'action' => 'rights',
17 'comment' => 'rights comment',
18 'user' => 0,
19 'user_text' => 'Sysop',
20 'namespace' => NS_USER,
21 'title' => 'User',
22 'params' => [
23 '4::oldgroups' => [],
24 '5::newgroups' => [ 'sysop', 'bureaucrat' ],
28 'text' => 'Sysop changed group membership for User from (none) to '
29 . 'administrator and bureaucrat',
30 'api' => [
31 'oldgroups' => [],
32 'newgroups' => [ 'sysop', 'bureaucrat' ],
37 // Legacy format
40 'type' => 'rights',
41 'action' => 'rights',
42 'comment' => 'rights comment',
43 'user' => 0,
44 'user_text' => 'Sysop',
45 'namespace' => NS_USER,
46 'title' => 'User',
47 'params' => [
48 '',
49 'sysop, bureaucrat',
53 'legacy' => true,
54 'text' => 'Sysop changed group membership for User from (none) to '
55 . 'administrator and bureaucrat',
56 'api' => [
57 'oldgroups' => [],
58 'newgroups' => [ 'sysop', 'bureaucrat' ],
63 // Really old entry
66 'type' => 'rights',
67 'action' => 'rights',
68 'comment' => 'rights comment',
69 'user' => 0,
70 'user_text' => 'Sysop',
71 'namespace' => NS_USER,
72 'title' => 'User',
73 'params' => [],
76 'legacy' => true,
77 'text' => 'Sysop changed group membership for User',
78 'api' => [],
84 /**
85 * @dataProvider provideRightsLogDatabaseRows
87 public function testRightsLogDatabaseRows( $row, $extra ) {
88 $this->doTestLogFormatter( $row, $extra );
91 /**
92 * Provide different rows from the logging table to test
93 * for backward compatibility.
94 * Do not change the existing data, just add a new database row
96 public static function provideAutopromoteLogDatabaseRows() {
97 return [
98 // Current format
101 'type' => 'rights',
102 'action' => 'autopromote',
103 'comment' => 'rights comment',
104 'user' => 0,
105 'user_text' => 'Sysop',
106 'namespace' => NS_USER,
107 'title' => 'Sysop',
108 'params' => [
109 '4::oldgroups' => [ 'sysop' ],
110 '5::newgroups' => [ 'sysop', 'bureaucrat' ],
114 'text' => 'Sysop was automatically promoted from administrator to '
115 . 'administrator and bureaucrat',
116 'api' => [
117 'oldgroups' => [ 'sysop' ],
118 'newgroups' => [ 'sysop', 'bureaucrat' ],
123 // Legacy format
126 'type' => 'rights',
127 'action' => 'autopromote',
128 'comment' => 'rights comment',
129 'user' => 0,
130 'user_text' => 'Sysop',
131 'namespace' => NS_USER,
132 'title' => 'Sysop',
133 'params' => [
134 'sysop',
135 'sysop, bureaucrat',
139 'legacy' => true,
140 'text' => 'Sysop was automatically promoted from administrator to '
141 . 'administrator and bureaucrat',
142 'api' => [
143 'oldgroups' => [ 'sysop' ],
144 'newgroups' => [ 'sysop', 'bureaucrat' ],
152 * @dataProvider provideAutopromoteLogDatabaseRows
154 public function testAutopromoteLogDatabaseRows( $row, $extra ) {
155 $this->doTestLogFormatter( $row, $extra );