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 expiry time of indefinite (anonymous users only)',
30 'duration' => 'infinite',
31 'flags' => array( 'anononly' ),
41 'comment' => 'Block comment',
43 'user_text' => 'Sysop',
44 'namespace' => NS_USER
,
45 'title' => 'Logtestuser',
53 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
55 'duration' => 'infinite',
56 'flags' => array( 'anononly' ),
61 // Old legacy log without flag
66 'comment' => 'Block comment',
68 'user_text' => 'Sysop',
69 'namespace' => NS_USER
,
70 'title' => 'Logtestuser',
77 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite',
79 'duration' => 'infinite',
85 // Very old legacy log without duration
90 'comment' => 'Block comment',
92 'user_text' => 'Sysop',
93 'namespace' => NS_USER
,
94 'title' => 'Logtestuser',
99 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite',
101 'duration' => 'infinite',
110 * @dataProvider provideBlockLogDatabaseRows
112 public function testBlockLogDatabaseRows( $row, $extra ) {
113 $this->doTestLogFormatter( $row, $extra );
117 * Provide different rows from the logging table to test
118 * for backward compatibility.
119 * Do not change the existing data, just add a new database row
121 public static function provideReblockLogDatabaseRows() {
123 // Current log format
127 'action' => 'reblock',
128 'comment' => 'Block comment',
130 'user_text' => 'Sysop',
131 'namespace' => NS_USER
,
132 'title' => 'Logtestuser',
134 '5::duration' => 'infinite',
135 '6::flags' => 'anononly',
139 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
140 . ' indefinite (anonymous users only)',
142 'duration' => 'infinite',
143 'flags' => array( 'anononly' ),
152 'action' => 'reblock',
153 'comment' => 'Block comment',
155 'user_text' => 'Sysop',
156 'namespace' => NS_USER
,
157 'title' => 'Logtestuser',
165 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
166 . ' indefinite (anonymous users only)',
168 'duration' => 'infinite',
169 'flags' => array( 'anononly' ),
174 // Older log without flag
178 'action' => 'reblock',
179 'comment' => 'Block comment',
181 'user_text' => 'Sysop',
182 'namespace' => NS_USER
,
183 'title' => 'Logtestuser',
190 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of indefinite',
192 'duration' => 'infinite',
201 * @dataProvider provideReblockLogDatabaseRows
203 public function testReblockLogDatabaseRows( $row, $extra ) {
204 $this->doTestLogFormatter( $row, $extra );
208 * Provide different rows from the logging table to test
209 * for backward compatibility.
210 * Do not change the existing data, just add a new database row
212 public static function provideUnblockLogDatabaseRows() {
214 // Current log format
218 'action' => 'unblock',
219 'comment' => 'Block comment',
221 'user_text' => 'Sysop',
222 'namespace' => NS_USER
,
223 'title' => 'Logtestuser',
227 'text' => 'Sysop unblocked Logtestuser',
235 * @dataProvider provideUnblockLogDatabaseRows
237 public function testUnblockLogDatabaseRows( $row, $extra ) {
238 $this->doTestLogFormatter( $row, $extra );
242 * Provide different rows from the logging table to test
243 * for backward compatibility.
244 * Do not change the existing data, just add a new database row
246 public static function provideSuppressBlockLogDatabaseRows() {
248 // Current log format
251 'type' => 'suppress',
253 'comment' => 'Block comment',
255 'user_text' => 'Sysop',
256 'namespace' => NS_USER
,
257 'title' => 'Logtestuser',
259 '5::duration' => 'infinite',
260 '6::flags' => 'anononly',
264 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
266 'duration' => 'infinite',
267 'flags' => array( 'anononly' ),
275 'type' => 'suppress',
277 'comment' => 'Block comment',
279 'user_text' => 'Sysop',
280 'namespace' => NS_USER
,
281 'title' => 'Logtestuser',
289 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
291 'duration' => 'infinite',
292 'flags' => array( 'anononly' ),
300 * @dataProvider provideSuppressBlockLogDatabaseRows
302 public function testSuppressBlockLogDatabaseRows( $row, $extra ) {
303 $this->doTestLogFormatter( $row, $extra );
307 * Provide different rows from the logging table to test
308 * for backward compatibility.
309 * Do not change the existing data, just add a new database row
311 public static function provideSuppressReblockLogDatabaseRows() {
313 // Current log format
316 'type' => 'suppress',
317 'action' => 'reblock',
318 'comment' => 'Block comment',
320 'user_text' => 'Sysop',
321 'namespace' => NS_USER
,
322 'title' => 'Logtestuser',
324 '5::duration' => 'infinite',
325 '6::flags' => 'anononly',
329 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
330 . ' indefinite (anonymous users only)',
332 'duration' => 'infinite',
333 'flags' => array( 'anononly' ),
341 'type' => 'suppress',
342 'action' => 'reblock',
343 'comment' => 'Block comment',
345 'user_text' => 'Sysop',
346 'namespace' => NS_USER
,
347 'title' => 'Logtestuser',
355 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
356 . ' indefinite (anonymous users only)',
358 'duration' => 'infinite',
359 'flags' => array( 'anononly' ),
367 * @dataProvider provideSuppressReblockLogDatabaseRows
369 public function testSuppressReblockLogDatabaseRows( $row, $extra ) {
370 $this->doTestLogFormatter( $row, $extra );