Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / logging / ImportLogFormatterTest.php
blobcf3612d7c27ae2596e35ac92b868b06016ee2753
1 <?php
3 use MediaWiki\Tests\Unit\DummyServicesTrait;
5 /**
6 * @covers \ImportLogFormatter
7 */
8 class ImportLogFormatterTest extends LogFormatterTestCase {
9 use DummyServicesTrait;
11 /**
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() {
17 return [
18 // Current format
21 'type' => 'import',
22 'action' => 'upload',
23 'comment' => 'upload comment',
24 'namespace' => NS_MAIN,
25 'title' => 'ImportPage',
26 'params' => [
27 '4:number:count' => '1',
31 'text' => 'User imported ImportPage by file upload (1 revision)',
32 'api' => [
33 'count' => 1,
38 // old format - without details
41 'type' => 'import',
42 'action' => 'upload',
43 'comment' => '1 revision: import comment',
44 'namespace' => NS_MAIN,
45 'title' => 'ImportPage',
46 'params' => [],
49 'text' => 'User imported ImportPage by file upload',
50 'api' => [],
56 /**
57 * @dataProvider provideUploadLogDatabaseRows
59 public function testUploadLogDatabaseRows( $row, $extra ) {
60 $this->doTestLogFormatter( $row, $extra );
63 /**
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() {
69 return [
70 // Current format
73 'type' => 'import',
74 'action' => 'interwiki',
75 'comment' => 'interwiki comment',
76 'namespace' => NS_MAIN,
77 'title' => 'ImportPage',
78 'params' => [
79 '4:number:count' => '1',
80 '5:title-link:interwiki' => 'importiw:PageImport',
84 'text' => 'User imported ImportPage from importiw:PageImport (1 revision)',
85 'api' => [
86 'count' => 1,
87 'interwiki_ns' => 0,
88 'interwiki_title' => 'importiw:PageImport',
93 // old format - without details
96 'type' => 'import',
97 'action' => 'interwiki',
98 'comment' => '1 revision from importiw:PageImport: interwiki comment',
99 'namespace' => NS_MAIN,
100 'title' => 'ImportPage',
101 'params' => [],
104 'text' => 'User imported ImportPage from another wiki',
105 'api' => [],
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 );