3 class RightsLogFormatterTest
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 provideRightsLogDatabaseRows() {
17 'comment' => 'rights comment',
19 'user_text' => 'Sysop',
20 'namespace' => NS_USER
,
24 '5::newgroups' => [ 'sysop', 'bureaucrat' ],
28 [ 'expiry' => '20160101123456' ]
33 'text' => 'Sysop changed group membership for User from (none) to '
34 . 'bureaucrat (temporary, until 12:34, 1 January 2016) and administrator',
37 'newgroups' => [ 'sysop', 'bureaucrat' ],
40 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
41 [ 'group' => 'bureaucrat', 'expiry' => '2016-01-01T12:34:56Z' ],
47 // Previous format (oldgroups and newgroups as arrays, no metadata)
52 'comment' => 'rights comment',
54 'user_text' => 'Sysop',
55 'namespace' => NS_USER
,
59 '5::newgroups' => [ 'sysop', 'bureaucrat' ],
63 'text' => 'Sysop changed group membership for User from (none) to '
64 . 'administrator and bureaucrat',
67 'newgroups' => [ 'sysop', 'bureaucrat' ],
70 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
71 [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ],
77 // Legacy format (oldgroups and newgroups as numeric-keyed strings)
82 'comment' => 'rights comment',
84 'user_text' => 'Sysop',
85 'namespace' => NS_USER
,
94 'text' => 'Sysop changed group membership for User from (none) to '
95 . 'administrator and bureaucrat',
98 'newgroups' => [ 'sysop', 'bureaucrat' ],
101 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
102 [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ],
112 'action' => 'rights',
113 'comment' => 'rights comment',
115 'user_text' => 'Sysop',
116 'namespace' => NS_USER
,
122 'text' => 'Sysop changed group membership for User',
130 * @dataProvider provideRightsLogDatabaseRows
132 public function testRightsLogDatabaseRows( $row, $extra ) {
133 $this->doTestLogFormatter( $row, $extra );
137 * Provide different rows from the logging table to test
138 * for backward compatibility.
139 * Do not change the existing data, just add a new database row
141 public static function provideAutopromoteLogDatabaseRows() {
147 'action' => 'autopromote',
148 'comment' => 'rights comment',
150 'user_text' => 'Sysop',
151 'namespace' => NS_USER
,
154 '4::oldgroups' => [ 'sysop' ],
155 '5::newgroups' => [ 'sysop', 'bureaucrat' ],
159 'text' => 'Sysop was automatically promoted from administrator to '
160 . 'administrator and bureaucrat',
162 'oldgroups' => [ 'sysop' ],
163 'newgroups' => [ 'sysop', 'bureaucrat' ],
165 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
168 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
169 [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ],
179 'action' => 'autopromote',
180 'comment' => 'rights comment',
182 'user_text' => 'Sysop',
183 'namespace' => NS_USER
,
192 'text' => 'Sysop was automatically promoted from administrator to '
193 . 'administrator and bureaucrat',
195 'oldgroups' => [ 'sysop' ],
196 'newgroups' => [ 'sysop', 'bureaucrat' ],
198 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
201 [ 'group' => 'sysop', 'expiry' => 'infinity' ],
202 [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ],
211 * @dataProvider provideAutopromoteLogDatabaseRows
213 public function testAutopromoteLogDatabaseRows( $row, $extra ) {
214 $this->doTestLogFormatter( $row, $extra );