<?php
+/**
+ * @covers BlockLogFormatter
+ */
class BlockLogFormatterTest extends LogFormatterTestCase {
/**
* Do not change the existing data, just add a new database row
*/
public static function provideBlockLogDatabaseRows() {
- return array(
+ return [
// Current log format
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'5::duration' => 'infinite',
'6::flags' => 'anononly',
- ),
- ),
- array(
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
- 'api' => array(
+ ],
+ ],
+ [
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
+ . ' (anonymous users only)',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// Old legacy log
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
'anononly',
- ),
- ),
- array(
+ ],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
- 'api' => array(
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
+ . ' (anonymous users only)',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// Old legacy log without flag
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
- ),
- ),
- array(
+ ],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite',
- 'api' => array(
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array(),
- ),
- ),
- ),
+ 'flags' => [],
+ ],
+ ],
+ ],
// Very old legacy log without duration
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(),
- ),
- array(
+ 'params' => [],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite',
- 'api' => array(
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array(),
- ),
- ),
- ),
- );
+ 'flags' => [],
+ ],
+ ],
+ ],
+ ];
}
/**
* Do not change the existing data, just add a new database row
*/
public static function provideReblockLogDatabaseRows() {
- return array(
+ return [
// Current log format
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'reblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'5::duration' => 'infinite',
'6::flags' => 'anononly',
- ),
- ),
- array(
- 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
+ ],
+ ],
+ [
+ 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
. ' indefinite (anonymous users only)',
- 'api' => array(
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// Old log
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'reblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
'anononly',
- ),
- ),
- array(
+ ],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
+ 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
. ' indefinite (anonymous users only)',
- 'api' => array(
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// Older log without flag
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'reblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
- )
- ),
- array(
+ ]
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of indefinite',
- 'api' => array(
+ 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of indefinite',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array(),
- ),
- ),
- ),
- );
+ 'flags' => [],
+ ],
+ ],
+ ],
+ ];
}
/**
* Do not change the existing data, just add a new database row
*/
public static function provideUnblockLogDatabaseRows() {
- return array(
+ return [
// Current log format
- array(
- array(
+ [
+ [
'type' => 'block',
'action' => 'unblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(),
- ),
- array(
+ 'params' => [],
+ ],
+ [
'text' => 'Sysop unblocked Logtestuser',
- 'api' => array(),
- ),
- ),
- );
+ 'api' => [],
+ ],
+ ],
+ ];
}
/**
* Do not change the existing data, just add a new database row
*/
public static function provideSuppressBlockLogDatabaseRows() {
- return array(
+ return [
// Current log format
- array(
- array(
+ [
+ [
'type' => 'suppress',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'5::duration' => 'infinite',
'6::flags' => 'anononly',
- ),
- ),
- array(
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
- 'api' => array(
+ ],
+ ],
+ [
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
+ . ' (anonymous users only)',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// legacy log
- array(
- array(
+ [
+ [
'type' => 'suppress',
'action' => 'block',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
'anononly',
- ),
- ),
- array(
+ ],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop blocked Logtestuser with an expiry time of indefinite (anonymous users only)',
- 'api' => array(
+ 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite'
+ . ' (anonymous users only)',
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
- );
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
+ ];
}
/**
* Do not change the existing data, just add a new database row
*/
public static function provideSuppressReblockLogDatabaseRows() {
- return array(
+ return [
// Current log format
- array(
- array(
+ [
+ [
'type' => 'suppress',
'action' => 'reblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'5::duration' => 'infinite',
'6::flags' => 'anononly',
- ),
- ),
- array(
- 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
+ ],
+ ],
+ [
+ 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
. ' indefinite (anonymous users only)',
- 'api' => array(
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
// Legacy format
- array(
- array(
+ [
+ [
'type' => 'suppress',
'action' => 'reblock',
'comment' => 'Block comment',
'user_text' => 'Sysop',
'namespace' => NS_USER,
'title' => 'Logtestuser',
- 'params' => array(
+ 'params' => [
'infinite',
'anononly',
- ),
- ),
- array(
+ ],
+ ],
+ [
'legacy' => true,
- 'text' => 'Sysop changed block settings for Logtestuser with an expiry time of'
+ 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of'
. ' indefinite (anonymous users only)',
- 'api' => array(
+ 'api' => [
'duration' => 'infinite',
- 'flags' => array( 'anononly' ),
- ),
- ),
- ),
- );
+ 'flags' => [ 'anononly' ],
+ ],
+ ],
+ ],
+ ];
}
/**