3 class BlockLogFormatterTest
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 provideBlockLogDatabaseRows() {
17 'comment' => 'Block comment',
19 'user_text' => 'Sysop',
20 'namespace' => NS_USER
,
21 'title' => 'Logtestuser',
23 '5::duration' => 'infinite',
24 '6::flags' => 'anononly',
28 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
29 . ' (anonymous users only)',
31 'duration' => 'infinite',
32 'flags' => [ 'anononly' ],
42 'comment' => 'Block comment',
44 'user_text' => 'Sysop',
45 'namespace' => NS_USER
,
46 'title' => 'Logtestuser',
54 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
55 . ' (anonymous users only)',
57 'duration' => 'infinite',
58 'flags' => [ 'anononly' ],
63 // Old legacy log without flag
68 'comment' => 'Block comment',
70 'user_text' => 'Sysop',
71 'namespace' => NS_USER
,
72 'title' => 'Logtestuser',
79 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite',
81 'duration' => 'infinite',
87 // Very old legacy log without duration
92 'comment' => 'Block comment',
94 'user_text' => 'Sysop',
95 'namespace' => NS_USER
,
96 'title' => 'Logtestuser',
101 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite',
103 'duration' => 'infinite',
112 * @dataProvider provideBlockLogDatabaseRows
114 public function testBlockLogDatabaseRows( $row, $extra ) {
115 $this->doTestLogFormatter( $row, $extra );
119 * Provide different rows from the logging table to test
120 * for backward compatibility.
121 * Do not change the existing data, just add a new database row
123 public static function provideReblockLogDatabaseRows() {
125 // Current log format
129 'action' => 'reblock',
130 'comment' => 'Block comment',
132 'user_text' => 'Sysop',
133 'namespace' => NS_USER
,
134 'title' => 'Logtestuser',
136 '5::duration' => 'infinite',
137 '6::flags' => 'anononly',
141 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
142 . ' indefinite (anonymous users only)',
144 'duration' => 'infinite',
145 'flags' => [ 'anononly' ],
154 'action' => 'reblock',
155 'comment' => 'Block comment',
157 'user_text' => 'Sysop',
158 'namespace' => NS_USER
,
159 'title' => 'Logtestuser',
167 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
168 . ' indefinite (anonymous users only)',
170 'duration' => 'infinite',
171 'flags' => [ 'anononly' ],
176 // Older log without flag
180 'action' => 'reblock',
181 'comment' => 'Block comment',
183 'user_text' => 'Sysop',
184 'namespace' => NS_USER
,
185 'title' => 'Logtestuser',
192 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of indefinite',
194 'duration' => 'infinite',
203 * @dataProvider provideReblockLogDatabaseRows
205 public function testReblockLogDatabaseRows( $row, $extra ) {
206 $this->doTestLogFormatter( $row, $extra );
210 * Provide different rows from the logging table to test
211 * for backward compatibility.
212 * Do not change the existing data, just add a new database row
214 public static function provideUnblockLogDatabaseRows() {
216 // Current log format
220 'action' => 'unblock',
221 'comment' => 'Block comment',
223 'user_text' => 'Sysop',
224 'namespace' => NS_USER
,
225 'title' => 'Logtestuser',
229 'text' => 'Sysop unblocked Logtestuser',
237 * @dataProvider provideUnblockLogDatabaseRows
239 public function testUnblockLogDatabaseRows( $row, $extra ) {
240 $this->doTestLogFormatter( $row, $extra );
244 * Provide different rows from the logging table to test
245 * for backward compatibility.
246 * Do not change the existing data, just add a new database row
248 public static function provideSuppressBlockLogDatabaseRows() {
250 // Current log format
253 'type' => 'suppress',
255 'comment' => 'Block comment',
257 'user_text' => 'Sysop',
258 'namespace' => NS_USER
,
259 'title' => 'Logtestuser',
261 '5::duration' => 'infinite',
262 '6::flags' => 'anononly',
266 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
267 . ' (anonymous users only)',
269 'duration' => 'infinite',
270 'flags' => [ 'anononly' ],
278 'type' => 'suppress',
280 'comment' => 'Block comment',
282 'user_text' => 'Sysop',
283 'namespace' => NS_USER
,
284 'title' => 'Logtestuser',
292 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
293 . ' (anonymous users only)',
295 'duration' => 'infinite',
296 'flags' => [ 'anononly' ],
304 * @dataProvider provideSuppressBlockLogDatabaseRows
306 public function testSuppressBlockLogDatabaseRows( $row, $extra ) {
307 $this->doTestLogFormatter( $row, $extra );
311 * Provide different rows from the logging table to test
312 * for backward compatibility.
313 * Do not change the existing data, just add a new database row
315 public static function provideSuppressReblockLogDatabaseRows() {
317 // Current log format
320 'type' => 'suppress',
321 'action' => 'reblock',
322 'comment' => 'Block comment',
324 'user_text' => 'Sysop',
325 'namespace' => NS_USER
,
326 'title' => 'Logtestuser',
328 '5::duration' => 'infinite',
329 '6::flags' => 'anononly',
333 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
334 . ' indefinite (anonymous users only)',
336 'duration' => 'infinite',
337 'flags' => [ 'anononly' ],
345 'type' => 'suppress',
346 'action' => 'reblock',
347 'comment' => 'Block comment',
349 'user_text' => 'Sysop',
350 'namespace' => NS_USER
,
351 'title' => 'Logtestuser',
359 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
360 . ' indefinite (anonymous users only)',
362 'duration' => 'infinite',
363 'flags' => [ 'anononly' ],
371 * @dataProvider provideSuppressReblockLogDatabaseRows
373 public function testSuppressReblockLogDatabaseRows( $row, $extra ) {
374 $this->doTestLogFormatter( $row, $extra );