4 * @covers ImportLogFormatter
6 class ImportLogFormatterTest
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 provideUploadLogDatabaseRows() {
20 'comment' => 'upload comment',
21 'namespace' => NS_MAIN
,
22 'title' => 'ImportPage',
24 '4:number:count' => '1',
28 'text' => 'User imported ImportPage by file upload (1 revision)',
35 // old format - without details
40 'comment' => '1 revision: import comment',
41 'namespace' => NS_MAIN
,
42 'title' => 'ImportPage',
46 'text' => 'User imported ImportPage by file upload',
54 * @dataProvider provideUploadLogDatabaseRows
56 public function testUploadLogDatabaseRows( $row, $extra ) {
57 $this->doTestLogFormatter( $row, $extra );
61 * Provide different rows from the logging table to test
62 * for backward compatibility.
63 * Do not change the existing data, just add a new database row
65 public static function provideInterwikiLogDatabaseRows() {
71 'action' => 'interwiki',
72 'comment' => 'interwiki comment',
73 'namespace' => NS_MAIN
,
74 'title' => 'ImportPage',
76 '4:number:count' => '1',
77 '5:title-link:interwiki' => 'importiw:PageImport',
81 'text' => 'User imported ImportPage from importiw:PageImport (1 revision)',
85 'interwiki_title' => 'importiw:PageImport',
90 // old format - without details
94 'action' => 'interwiki',
95 'comment' => '1 revision from importiw:PageImport: interwiki comment',
96 'namespace' => NS_MAIN
,
97 'title' => 'ImportPage',
101 'text' => 'User imported ImportPage from another wiki',
109 * @dataProvider provideInterwikiLogDatabaseRows
111 public function testInterwikiLogDatabaseRows( $row, $extra ) {
112 // Setup importiw: as interwiki prefix
113 $this->setMwGlobals( 'wgHooks', [
114 'InterwikiLoadPrefix' => [
115 function ( $prefix, &$data ) {
116 if ( $prefix == 'importiw' ) {
117 $data = [ 'iw_url' => 'wikipedia' ];
124 $this->doTestLogFormatter( $row, $extra );