6 class NewUsersLogFormatterTest
extends LogFormatterTestCase
{
8 protected function setUp() {
11 // Register LogHandler, see $wgNewUserLog in Setup.php
12 $this->mergeMwGlobalArrayValue( 'wgLogActionsHandlers', [
13 'newusers/newusers' => 'NewUsersLogFormatter',
14 'newusers/create' => 'NewUsersLogFormatter',
15 'newusers/create2' => 'NewUsersLogFormatter',
16 'newusers/byemail' => 'NewUsersLogFormatter',
17 'newusers/autocreate' => 'NewUsersLogFormatter',
22 * Provide different rows from the logging table to test
23 * for backward compatibility.
24 * Do not change the existing data, just add a new database row
26 public static function provideNewUsersLogDatabaseRows() {
32 'action' => 'newusers',
33 'comment' => 'newusers comment',
35 'user_text' => 'New user',
36 'namespace' => NS_USER
,
37 'title' => 'New user',
42 'text' => 'User account New user was created',
50 * @dataProvider provideNewUsersLogDatabaseRows
52 public function testNewUsersLogDatabaseRows( $row, $extra ) {
53 $this->doTestLogFormatter( $row, $extra );
57 * Provide different rows from the logging table to test
58 * for backward compatibility.
59 * Do not change the existing data, just add a new database row
61 public static function provideCreateLogDatabaseRows() {
68 'comment' => 'newusers comment',
70 'user_text' => 'New user',
71 'namespace' => NS_USER
,
72 'title' => 'New user',
78 'text' => 'User account New user was created',
88 * @dataProvider provideCreateLogDatabaseRows
90 public function testCreateLogDatabaseRows( $row, $extra ) {
91 $this->doTestLogFormatter( $row, $extra );
95 * Provide different rows from the logging table to test
96 * for backward compatibility.
97 * Do not change the existing data, just add a new database row
99 public static function provideCreate2LogDatabaseRows() {
104 'type' => 'newusers',
105 'action' => 'create2',
106 'comment' => 'newusers comment',
108 'user_text' => 'User',
109 'namespace' => NS_USER
,
110 'title' => 'UTSysop',
116 'text' => 'User account UTSysop was created by User',
126 * @dataProvider provideCreate2LogDatabaseRows
128 public function testCreate2LogDatabaseRows( $row, $extra ) {
129 $this->doTestLogFormatter( $row, $extra );
133 * Provide different rows from the logging table to test
134 * for backward compatibility.
135 * Do not change the existing data, just add a new database row
137 public static function provideByemailLogDatabaseRows() {
142 'type' => 'newusers',
143 'action' => 'byemail',
144 'comment' => 'newusers comment',
146 'user_text' => 'Sysop',
147 'namespace' => NS_USER
,
148 'title' => 'UTSysop',
154 'text' => 'User account UTSysop was created by Sysop and password was sent by email',
164 * @dataProvider provideByemailLogDatabaseRows
166 public function testByemailLogDatabaseRows( $row, $extra ) {
167 $this->doTestLogFormatter( $row, $extra );
171 * Provide different rows from the logging table to test
172 * for backward compatibility.
173 * Do not change the existing data, just add a new database row
175 public static function provideAutocreateLogDatabaseRows() {
180 'type' => 'newusers',
181 'action' => 'autocreate',
182 'comment' => 'newusers comment',
184 'user_text' => 'New user',
185 'namespace' => NS_USER
,
186 'title' => 'New user',
192 'text' => 'User account New user was created automatically',
202 * @dataProvider provideAutocreateLogDatabaseRows
204 public function testAutocreateLogDatabaseRows( $row, $extra ) {
205 $this->doTestLogFormatter( $row, $extra );