3 use MediaWiki\Tests\Unit\DummyServicesTrait
;
6 * @covers \ImportLogFormatter
8 class ImportLogFormatterTest
extends LogFormatterTestCase
{
9 use DummyServicesTrait
;
12 * Provide different rows from the logging table to test
13 * for backward compatibility.
14 * Do not change the existing data, just add a new database row
16 public static function provideUploadLogDatabaseRows() {
23 'comment' => 'upload comment',
24 'namespace' => NS_MAIN
,
25 'title' => 'ImportPage',
27 '4:number:count' => '1',
31 'text' => 'User imported ImportPage by file upload (1 revision)',
38 // old format - without details
43 'comment' => '1 revision: import comment',
44 'namespace' => NS_MAIN
,
45 'title' => 'ImportPage',
49 'text' => 'User imported ImportPage by file upload',
57 * @dataProvider provideUploadLogDatabaseRows
59 public function testUploadLogDatabaseRows( $row, $extra ) {
60 $this->doTestLogFormatter( $row, $extra );
64 * Provide different rows from the logging table to test
65 * for backward compatibility.
66 * Do not change the existing data, just add a new database row
68 public static function provideInterwikiLogDatabaseRows() {
74 'action' => 'interwiki',
75 'comment' => 'interwiki comment',
76 'namespace' => NS_MAIN
,
77 'title' => 'ImportPage',
79 '4:number:count' => '1',
80 '5:title-link:interwiki' => 'importiw:PageImport',
84 'text' => 'User imported ImportPage from importiw:PageImport (1 revision)',
88 'interwiki_title' => 'importiw:PageImport',
93 // old format - without details
97 'action' => 'interwiki',
98 'comment' => '1 revision from importiw:PageImport: interwiki comment',
99 'namespace' => NS_MAIN
,
100 'title' => 'ImportPage',
104 'text' => 'User imported ImportPage from another wiki',
112 * @dataProvider provideInterwikiLogDatabaseRows
114 public function testInterwikiLogDatabaseRows( $row, $extra ) {
115 // Setup importiw: as interwiki prefix
116 $interwikiLookup = $this->getDummyInterwikiLookup( [ 'importiw' ] );
117 $this->setService( 'InterwikiLookup', $interwikiLookup );
119 $this->doTestLogFormatter( $row, $extra );