Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / phpunit / includes / logging / MoveLogFormatterTest.php
blob3433a6a4335b4d0242abeca39c84c83e8780b081
1 <?php
3 class MoveLogFormatterTest extends LogFormatterTestCase {
5 /**
6 * Provide different rows from the logging table to test
7 * for backward compatibility.
8 * Do not change the existing data, just add a new database row
9 */
10 public static function provideMoveLogDatabaseRows() {
11 return [
12 // Current format - with redirect
15 'type' => 'move',
16 'action' => 'move',
17 'comment' => 'move comment with redirect',
18 'namespace' => NS_MAIN,
19 'title' => 'OldPage',
20 'params' => [
21 '4::target' => 'NewPage',
22 '5::noredir' => '0',
26 'text' => 'User moved page OldPage to NewPage',
27 'api' => [
28 'target_ns' => 0,
29 'target_title' => 'NewPage',
30 'suppressredirect' => false,
35 // Current format - without redirect
38 'type' => 'move',
39 'action' => 'move',
40 'comment' => 'move comment',
41 'namespace' => NS_MAIN,
42 'title' => 'OldPage',
43 'params' => [
44 '4::target' => 'NewPage',
45 '5::noredir' => '1',
49 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
50 'api' => [
51 'target_ns' => 0,
52 'target_title' => 'NewPage',
53 'suppressredirect' => true,
58 // legacy format - with redirect
61 'type' => 'move',
62 'action' => 'move',
63 'comment' => 'move comment',
64 'namespace' => NS_MAIN,
65 'title' => 'OldPage',
66 'params' => [
67 'NewPage',
68 '',
72 'legacy' => true,
73 'text' => 'User moved page OldPage to NewPage',
74 'api' => [
75 'target_ns' => 0,
76 'target_title' => 'NewPage',
77 'suppressredirect' => false,
82 // legacy format - without redirect
85 'type' => 'move',
86 'action' => 'move',
87 'comment' => 'move comment',
88 'namespace' => NS_MAIN,
89 'title' => 'OldPage',
90 'params' => [
91 'NewPage',
92 '1',
96 'legacy' => true,
97 'text' => 'User moved page OldPage to NewPage without leaving a redirect',
98 'api' => [
99 'target_ns' => 0,
100 'target_title' => 'NewPage',
101 'suppressredirect' => true,
106 // old format without flag for redirect suppression
109 'type' => 'move',
110 'action' => 'move',
111 'comment' => 'move comment',
112 'namespace' => NS_MAIN,
113 'title' => 'OldPage',
114 'params' => [
115 'NewPage',
119 'legacy' => true,
120 'text' => 'User moved page OldPage to NewPage',
121 'api' => [
122 'target_ns' => 0,
123 'target_title' => 'NewPage',
124 'suppressredirect' => false,
132 * @dataProvider provideMoveLogDatabaseRows
134 public function testMoveLogDatabaseRows( $row, $extra ) {
135 $this->doTestLogFormatter( $row, $extra );
139 * Provide different rows from the logging table to test
140 * for backward compatibility.
141 * Do not change the existing data, just add a new database row
143 public static function provideMoveRedirLogDatabaseRows() {
144 return [
145 // Current format - with redirect
148 'type' => 'move',
149 'action' => 'move_redir',
150 'comment' => 'move comment with redirect',
151 'namespace' => NS_MAIN,
152 'title' => 'OldPage',
153 'params' => [
154 '4::target' => 'NewPage',
155 '5::noredir' => '0',
159 'text' => 'User moved page OldPage to NewPage over redirect',
160 'api' => [
161 'target_ns' => 0,
162 'target_title' => 'NewPage',
163 'suppressredirect' => false,
168 // Current format - without redirect
171 'type' => 'move',
172 'action' => 'move_redir',
173 'comment' => 'move comment',
174 'namespace' => NS_MAIN,
175 'title' => 'OldPage',
176 'params' => [
177 '4::target' => 'NewPage',
178 '5::noredir' => '1',
182 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
183 'api' => [
184 'target_ns' => 0,
185 'target_title' => 'NewPage',
186 'suppressredirect' => true,
191 // legacy format - with redirect
194 'type' => 'move',
195 'action' => 'move_redir',
196 'comment' => 'move comment',
197 'namespace' => NS_MAIN,
198 'title' => 'OldPage',
199 'params' => [
200 'NewPage',
205 'legacy' => true,
206 'text' => 'User moved page OldPage to NewPage over redirect',
207 'api' => [
208 'target_ns' => 0,
209 'target_title' => 'NewPage',
210 'suppressredirect' => false,
215 // legacy format - without redirect
218 'type' => 'move',
219 'action' => 'move_redir',
220 'comment' => 'move comment',
221 'namespace' => NS_MAIN,
222 'title' => 'OldPage',
223 'params' => [
224 'NewPage',
225 '1',
229 'legacy' => true,
230 'text' => 'User moved page OldPage to NewPage over a redirect without leaving a redirect',
231 'api' => [
232 'target_ns' => 0,
233 'target_title' => 'NewPage',
234 'suppressredirect' => true,
239 // old format without flag for redirect suppression
242 'type' => 'move',
243 'action' => 'move_redir',
244 'comment' => 'move comment',
245 'namespace' => NS_MAIN,
246 'title' => 'OldPage',
247 'params' => [
248 'NewPage',
252 'legacy' => true,
253 'text' => 'User moved page OldPage to NewPage over redirect',
254 'api' => [
255 'target_ns' => 0,
256 'target_title' => 'NewPage',
257 'suppressredirect' => false,
265 * @dataProvider provideMoveRedirLogDatabaseRows
267 public function testMoveRedirLogDatabaseRows( $row, $extra ) {
268 $this->doTestLogFormatter( $row, $extra );