diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2021-12-04 22:14:56 +0100 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2022-04-12 20:57:18 +0000 |
commit | d7809a41d97a108c0a68d23dfe14d84e57cb1db4 (patch) | |
tree | 3f6f15046c5241dad6082081ebb1b9be1855235f /tests/phpunit/includes/logging/BlockLogFormatterTest.php | |
parent | 3dd77b0c470522d591f587c9c89548376be874ba (diff) | |
download | mediawikicore-d7809a41d97a108c0a68d23dfe14d84e57cb1db4.tar.gz mediawikicore-d7809a41d97a108c0a68d23dfe14d84e57cb1db4.zip |
logging: Normalize "infinity" in BlockLogFormatter for pre-T241709 rows
This allows the API to consistently return the new value for old rows.
Bug: T241709
Follow-Up: I36f49dc83718cc78f17fc340e6445030b8fd0c66
Change-Id: Ida69980f62a6ef070ba41b7e826967f424881716
Diffstat (limited to 'tests/phpunit/includes/logging/BlockLogFormatterTest.php')
-rw-r--r-- | tests/phpunit/includes/logging/BlockLogFormatterTest.php | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/tests/phpunit/includes/logging/BlockLogFormatterTest.php b/tests/phpunit/includes/logging/BlockLogFormatterTest.php index 9c1166469fe3..b57d482eb746 100644 --- a/tests/phpunit/includes/logging/BlockLogFormatterTest.php +++ b/tests/phpunit/includes/logging/BlockLogFormatterTest.php @@ -23,6 +23,32 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'namespace' => NS_USER, 'title' => 'Logtestuser', 'params' => [ + '5::duration' => 'infinity', + '6::flags' => 'anononly', + ], + ], + [ + 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite' + . ' (anonymous users only)', + 'api' => [ + 'duration' => 'infinity', + 'flags' => [ 'anononly' ], + ], + 'preload' => [ new TitleValue( NS_USER_TALK, 'Logtestuser' ) ], + ], + ], + + // Old log format with one of the 4 values for 'infinity' + [ + [ + 'type' => 'block', + 'action' => 'block', + 'comment' => 'Block comment', + 'user' => 0, + 'user_text' => 'Sysop', + 'namespace' => NS_USER, + 'title' => 'Logtestuser', + 'params' => [ '5::duration' => 'infinite', '6::flags' => 'anononly', ], @@ -31,7 +57,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite' . ' (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], 'preload' => [ new TitleValue( NS_USER_TALK, 'Logtestuser' ) ], @@ -54,7 +80,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked (no username available) ' . 'with an expiration time of indefinite', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [], ], 'preload' => [], @@ -81,7 +107,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite' . ' (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -105,7 +131,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'legacy' => true, 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [], ], ], @@ -127,7 +153,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'legacy' => true, 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [], ], ], @@ -168,7 +194,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of' . ' indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -194,7 +220,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of' . ' indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -218,7 +244,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'legacy' => true, 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of indefinite', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [], ], ], @@ -293,7 +319,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite' . ' (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -319,7 +345,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser with an expiration time of indefinite' . ' (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -368,7 +394,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { [ 'text' => '(username removed) (log details removed)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -393,7 +419,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'legacy' => true, 'text' => '(username removed) (log details removed)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -435,7 +461,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of' . ' indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -461,7 +487,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop changed block settings for Logtestuser with an expiration time of' . ' indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -510,7 +536,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { [ 'text' => '(username removed) (log details removed)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -535,7 +561,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'legacy' => true, 'text' => '(username removed) (log details removed)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], ], ], @@ -573,7 +599,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser from the pages User:Test1 and Main Page' . ' with an expiration time of indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], 'restrictions' => [ 'pages' => [ @@ -612,7 +638,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser from the namespace User' . ' with an expiration time of indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], 'restrictions' => [ 'namespaces' => [ NS_USER ], @@ -645,7 +671,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { . ' namespaces User and (Main) with an expiration time of indefinite' . ' (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], 'restrictions' => [ 'pages' => [ @@ -679,7 +705,7 @@ class BlockLogFormatterTest extends LogFormatterTestCase { 'text' => 'Sysop blocked Logtestuser from specified non-editing actions' . ' with an expiration time of indefinite (anonymous users only)', 'api' => [ - 'duration' => 'infinite', + 'duration' => 'infinity', 'flags' => [ 'anononly' ], 'sitewide' => false, ], |