Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / logging / PageLangLogFormatterTest.php
blob79d99457db347f9bf77d742d9998f09d45fb1c8e
1 <?php
3 use MediaWiki\MainConfigNames;
4 use MediaWiki\MainConfigSchema;
6 /**
7 * @covers \PageLangLogFormatter
8 */
9 class PageLangLogFormatterTest extends LogFormatterTestCase {
11 protected function setUp(): void {
12 parent::setUp();
14 // Clear all hooks to disable cldr extension
15 $this->clearHooks();
17 // Register LogHandler, see $wgPageLanguageUseDB in Setup.php
18 $this->overrideConfigValue(
19 MainConfigNames::LogActionsHandlers,
20 MainConfigSchema::getDefaultValue( MainConfigNames::LogActionsHandlers ) +
22 'pagelang/pagelang' => [
23 'class' => PageLangLogFormatter::class,
24 'services' => [
25 'LanguageNameUtils',
32 /**
33 * Provide different rows from the logging table to test
34 * for backward compatibility.
35 * Do not change the existing data, just add a new database row
37 public static function providePageLangLogDatabaseRows() {
38 return [
39 // Current format
42 'type' => 'pagelang',
43 'action' => 'pagelang',
44 'comment' => 'page lang comment',
45 'namespace' => NS_MAIN,
46 'title' => 'Page',
47 'params' => [
48 '4::oldlanguage' => 'en',
49 '5::newlanguage' => 'de[def]',
53 'text' => 'User changed the language of Page from English (en) to Deutsch (de) [default]',
54 'api' => [
55 'oldlanguage' => 'en',
56 'newlanguage' => 'de[def]'
63 /**
64 * @dataProvider providePageLangLogDatabaseRows
66 public function testPageLangLogDatabaseRows( $row, $extra ) {
67 $this->doTestLogFormatter( $row, $extra );