X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flogging%2FNewUsersLogFormatterTest.php;h=eee2981c1856db2d7abc926b3e9c1a61bc672bd9;hb=1c65dd29a3c77173625b9a0f8b59ea1c1c12fc2c;hp=c4b52f0d983c95b2b22749dbc0247d0c17088537;hpb=a5be382adfdad4678eec18413c6a118cb3284daf;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php b/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php index c4b52f0d98..eee2981c18 100644 --- a/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php +++ b/tests/phpunit/includes/logging/NewUsersLogFormatterTest.php @@ -1,6 +1,7 @@ mergeMwGlobalArrayValue( 'wgLogActionsHandlers', [ - 'newusers/newusers' => 'NewUsersLogFormatter', - 'newusers/create' => 'NewUsersLogFormatter', - 'newusers/create2' => 'NewUsersLogFormatter', - 'newusers/byemail' => 'NewUsersLogFormatter', - 'newusers/autocreate' => 'NewUsersLogFormatter', + 'newusers/newusers' => NewUsersLogFormatter::class, + 'newusers/create' => NewUsersLogFormatter::class, + 'newusers/create2' => NewUsersLogFormatter::class, + 'newusers/byemail' => NewUsersLogFormatter::class, + 'newusers/autocreate' => NewUsersLogFormatter::class, ] ); } @@ -107,16 +108,10 @@ class NewUsersLogFormatterTest extends LogFormatterTestCase { 'user' => 0, 'user_text' => 'User', 'namespace' => NS_USER, - 'title' => 'UTSysop', - 'params' => [ - '4::userid' => 1, - ], + 'title' => 'UTSysop' ], [ - 'text' => 'User account UTSysop was created by User', - 'api' => [ - 'userid' => 1, - ], + 'text' => 'User account UTSysop was created by User' ], ], ]; @@ -126,6 +121,10 @@ class NewUsersLogFormatterTest extends LogFormatterTestCase { * @dataProvider provideCreate2LogDatabaseRows */ public function testCreate2LogDatabaseRows( $row, $extra ) { + // Make UTSysop user and use its user_id (sequence does not reset to 1 for postgres) + $user = static::getTestSysop()->getUser(); + $row['params']['4::userid'] = $user->getId(); + $extra['api']['userid'] = $user->getId(); $this->doTestLogFormatter( $row, $extra ); } @@ -145,16 +144,10 @@ class NewUsersLogFormatterTest extends LogFormatterTestCase { 'user' => 0, 'user_text' => 'Sysop', 'namespace' => NS_USER, - 'title' => 'UTSysop', - 'params' => [ - '4::userid' => 1, - ], + 'title' => 'UTSysop' ], [ - 'text' => 'User account UTSysop was created by Sysop and password was sent by email', - 'api' => [ - 'userid' => 1, - ], + 'text' => 'User account UTSysop was created by Sysop and password was sent by email' ], ], ]; @@ -164,6 +157,10 @@ class NewUsersLogFormatterTest extends LogFormatterTestCase { * @dataProvider provideByemailLogDatabaseRows */ public function testByemailLogDatabaseRows( $row, $extra ) { + // Make UTSysop user and use its user_id (sequence does not reset to 1 for postgres) + $user = static::getTestSysop()->getUser(); + $row['params']['4::userid'] = $user->getId(); + $extra['api']['userid'] = $user->getId(); $this->doTestLogFormatter( $row, $extra ); }