X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flogging%2FRightsLogFormatterTest.php;h=d081c61bb766056fe5937841863a7e21008dc6c6;hb=c368a4313b4183af56b0d566e1f7529ba997a110;hp=a81e7ec30b39d4b2b1ef264124e32fd380b370d7;hpb=2f885ee6b797e5a176ce7b270b674a04b5945b06;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/logging/RightsLogFormatterTest.php b/tests/phpunit/includes/logging/RightsLogFormatterTest.php index a81e7ec30b..d081c61bb7 100644 --- a/tests/phpunit/includes/logging/RightsLogFormatterTest.php +++ b/tests/phpunit/includes/logging/RightsLogFormatterTest.php @@ -1,5 +1,8 @@ 'rights', + 'action' => 'rights', + 'comment' => 'rights comment', + 'user' => 0, + 'user_text' => 'Sysop', + 'namespace' => NS_USER, + 'title' => 'User', + 'params' => [ + '4::oldgroups' => [], + '5::newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [], + 'newmetadata' => [ + [ 'expiry' => null ], + [ 'expiry' => '20160101123456' ] + ], + ], + ], + [ + 'text' => 'Sysop changed group membership for User from (none) to ' + . 'bureaucrat (temporary, until 12:34, 1 January 2016) and administrator', + 'api' => [ + 'oldgroups' => [], + 'newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [], + 'newmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + [ 'group' => 'bureaucrat', 'expiry' => '2016-01-01T12:34:56Z' ], + ], + ], + ], + ], + + // Previous format (oldgroups and newgroups as arrays, no metadata) [ [ 'type' => 'rights', @@ -30,11 +68,16 @@ class RightsLogFormatterTest extends LogFormatterTestCase { 'api' => [ 'oldgroups' => [], 'newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [], + 'newmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ], + ], ], ], ], - // Legacy format + // Legacy format (oldgroups and newgroups as numeric-keyed strings) [ [ 'type' => 'rights', @@ -56,6 +99,11 @@ class RightsLogFormatterTest extends LogFormatterTestCase { 'api' => [ 'oldgroups' => [], 'newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [], + 'newmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ], + ], ], ], ], @@ -116,6 +164,13 @@ class RightsLogFormatterTest extends LogFormatterTestCase { 'api' => [ 'oldgroups' => [ 'sysop' ], 'newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + ], + 'newmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ], + ], ], ], ], @@ -142,6 +197,13 @@ class RightsLogFormatterTest extends LogFormatterTestCase { 'api' => [ 'oldgroups' => [ 'sysop' ], 'newgroups' => [ 'sysop', 'bureaucrat' ], + 'oldmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + ], + 'newmetadata' => [ + [ 'group' => 'sysop', 'expiry' => 'infinity' ], + [ 'group' => 'bureaucrat', 'expiry' => 'infinity' ], + ], ], ], ],