X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flogging%2FBlockLogFormatterTest.php;h=03671ac87061740647f1f3e56ff1af068d1895fe;hb=fe4b09380562976aea9f06e59d342fff8d91b026;hp=c7dc641d23c071c449ae29d57a84a6867ca28e6d;hpb=d1150378f15b4dd699220bee41d0ce3af8868a18;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/logging/BlockLogFormatterTest.php b/tests/phpunit/includes/logging/BlockLogFormatterTest.php index c7dc641d23..03671ac870 100644 --- a/tests/phpunit/includes/logging/BlockLogFormatterTest.php +++ b/tests/phpunit/includes/logging/BlockLogFormatterTest.php @@ -1,5 +1,8 @@ 'block', 'action' => 'block', 'comment' => 'Block comment', @@ -19,23 +22,24 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -43,24 +47,25 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -68,23 +73,23 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -92,18 +97,18 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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' => [], + ], + ], + ], + ]; } /** @@ -119,10 +124,10 @@ class BlockLogFormatterTest extends LogFormatterTestCase { * 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', @@ -130,24 +135,24 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -155,25 +160,25 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -181,20 +186,20 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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' => [], + ], + ], + ], + ]; } /** @@ -210,10 +215,10 @@ class BlockLogFormatterTest extends LogFormatterTestCase { * 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', @@ -221,14 +226,14 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'user_text' => 'Sysop', 'namespace' => NS_USER, 'title' => 'Logtestuser', - 'params' => array(), - ), - array( + 'params' => [], + ], + [ 'text' => 'Sysop unblocked Logtestuser', - 'api' => array(), - ), - ), - ); + 'api' => [], + ], + ], + ]; } /** @@ -244,10 +249,10 @@ class BlockLogFormatterTest extends LogFormatterTestCase { * 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', @@ -255,23 +260,24 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -279,21 +285,22 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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' ], + ], + ], + ], + ]; } /** @@ -309,10 +316,10 @@ class BlockLogFormatterTest extends LogFormatterTestCase { * 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', @@ -320,24 +327,24 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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', @@ -345,22 +352,22 @@ class BlockLogFormatterTest extends LogFormatterTestCase { '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' ], + ], + ], + ], + ]; } /**