3 class ImportLogFormatterTest
extends LogFormatterTestCase
{
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
10 public static function provideUploadLogDatabaseRows() {
17 'comment' => 'upload comment',
18 'namespace' => NS_MAIN
,
19 'title' => 'ImportPage',
21 '4:number:count' => '1',
25 'text' => 'User imported ImportPage by file upload (1 revision)',
32 // old format - without details
37 'comment' => '1 revision: import comment',
38 'namespace' => NS_MAIN
,
39 'title' => 'ImportPage',
43 'text' => 'User imported ImportPage by file upload',
51 * @dataProvider provideUploadLogDatabaseRows
53 public function testUploadLogDatabaseRows( $row, $extra ) {
54 $this->doTestLogFormatter( $row, $extra );
58 * Provide different rows from the logging table to test
59 * for backward compatibility.
60 * Do not change the existing data, just add a new database row
62 public static function provideInterwikiLogDatabaseRows() {
68 'action' => 'interwiki',
69 'comment' => 'interwiki comment',
70 'namespace' => NS_MAIN
,
71 'title' => 'ImportPage',
73 '4:number:count' => '1',
74 '5:title-link:interwiki' => 'importiw:PageImport',
78 'text' => 'User imported ImportPage from importiw:PageImport (1 revision)',
82 'interwiki_title' => 'importiw:PageImport',
87 // old format - without details
91 'action' => 'interwiki',
92 'comment' => '1 revision from importiw:PageImport: interwiki comment',
93 'namespace' => NS_MAIN
,
94 'title' => 'ImportPage',
98 'text' => 'User imported ImportPage from another wiki',
106 * @dataProvider provideInterwikiLogDatabaseRows
108 public function testInterwikiLogDatabaseRows( $row, $extra ) {
109 // Setup importiw: as interwiki prefix
110 $this->setMwGlobals( 'wgHooks', [
111 'InterwikiLoadPrefix' => [
112 function ( $prefix, &$data ) {
113 if ( $prefix == 'importiw' ) {
114 $data = [ 'iw_url' => 'wikipedia' ];
121 $this->doTestLogFormatter( $row, $extra );