4 * @covers \MoveLogFormatter
6 class MoveLogFormatterTest
extends LogFormatterTestCase
{
9 * Provide different rows from the logging table to test
10 * for backward compatibility.
11 * Do not change the existing data, just add a new database row
13 public static function provideMoveLogDatabaseRows() {
15 // Current format - with redirect
20 'comment' => 'move comment with redirect',
21 'namespace' => NS_MAIN
,
24 '4::target' => 'NewPage',
29 'text' => 'User moved page OldPage to NewPage',
32 'target_title' => 'NewPage',
33 'suppressredirect' => false,
38 // Current format - without redirect
43 'comment' => 'move comment',
44 'namespace' => NS_MAIN
,
47 '4::target' => 'NewPage',
52 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
55 'target_title' => 'NewPage',
56 'suppressredirect' => true,
61 // legacy format - with redirect
66 'comment' => 'move comment',
67 'namespace' => NS_MAIN
,
76 'text' => 'User moved page OldPage to NewPage',
79 'target_title' => 'NewPage',
80 'suppressredirect' => false,
85 // legacy format - without redirect
90 'comment' => 'move comment',
91 'namespace' => NS_MAIN
,
100 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
103 'target_title' => 'NewPage',
104 'suppressredirect' => true,
109 // old format without flag for redirect suppression
114 'comment' => 'move comment',
115 'namespace' => NS_MAIN
,
116 'title' => 'OldPage',
123 'text' => 'User moved page OldPage to NewPage',
126 'target_title' => 'NewPage',
127 'suppressredirect' => false,
132 // row with invalid title (T370396)
137 'comment' => 'comment',
138 'namespace' => NS_TALK
,
139 'title' => 'OldPage',
141 '4::target' => 'Talk:Help:NewPage',
146 'text' => 'User moved page Talk:OldPage to Invalid title',
149 'target_title' => 'Special:Badtitle/Talk:Help:NewPage',
150 'suppressredirect' => false,
152 'preload' => [ /* empty, do not try to preload the bad title */ ],
159 * @dataProvider provideMoveLogDatabaseRows
161 public function testMoveLogDatabaseRows( $row, $extra ) {
162 $this->doTestLogFormatter( $row, $extra );
166 * Provide different rows from the logging table to test
167 * for backward compatibility.
168 * Do not change the existing data, just add a new database row
170 public static function provideMoveRedirLogDatabaseRows() {
172 // Current format - with redirect
176 'action' => 'move_redir',
177 'comment' => 'move comment with redirect',
178 'namespace' => NS_MAIN
,
179 'title' => 'OldPage',
181 '4::target' => 'NewPage',
186 'text' => 'User moved page OldPage to NewPage over redirect',
189 'target_title' => 'NewPage',
190 'suppressredirect' => false,
195 // Current format - without redirect
199 'action' => 'move_redir',
200 'comment' => 'move comment',
201 'namespace' => NS_MAIN
,
202 'title' => 'OldPage',
204 '4::target' => 'NewPage',
209 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
212 'target_title' => 'NewPage',
213 'suppressredirect' => true,
218 // legacy format - with redirect
222 'action' => 'move_redir',
223 'comment' => 'move comment',
224 'namespace' => NS_MAIN
,
225 'title' => 'OldPage',
233 'text' => 'User moved page OldPage to NewPage over redirect',
236 'target_title' => 'NewPage',
237 'suppressredirect' => false,
242 // legacy format - without redirect
246 'action' => 'move_redir',
247 'comment' => 'move comment',
248 'namespace' => NS_MAIN
,
249 'title' => 'OldPage',
257 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
260 'target_title' => 'NewPage',
261 'suppressredirect' => true,
266 // old format without flag for redirect suppression
270 'action' => 'move_redir',
271 'comment' => 'move comment',
272 'namespace' => NS_MAIN
,
273 'title' => 'OldPage',
280 'text' => 'User moved page OldPage to NewPage over redirect',
283 'target_title' => 'NewPage',
284 'suppressredirect' => false,
292 * @dataProvider provideMoveRedirLogDatabaseRows
294 public function testMoveRedirLogDatabaseRows( $row, $extra ) {
295 $this->doTestLogFormatter( $row, $extra );