MediaWiki REL1_31
PageLangLogFormatterTest.php
Go to the documentation of this file.
1<?php
2
7
8 protected function setUp() {
9 parent::setUp();
10
11 // Disable cldr extension
12 $this->setMwGlobals( 'wgHooks', [] );
13 // Register LogHandler, see $wgPageLanguageUseDB in Setup.php
14 $this->mergeMwGlobalArrayValue( 'wgLogActionsHandlers', [
15 'pagelang/pagelang' => PageLangLogFormatter::class,
16 ] );
17 }
18
24 public static function providePageLangLogDatabaseRows() {
25 return [
26 // Current format
27 [
28 [
29 'type' => 'pagelang',
30 'action' => 'pagelang',
31 'comment' => 'page lang comment',
32 'namespace' => NS_MAIN,
33 'title' => 'Page',
34 'params' => [
35 '4::oldlanguage' => 'en',
36 '5::newlanguage' => 'de[def]',
37 ],
38 ],
39 [
40 'text' => 'User changed the language of Page from English (en) to Deutsch (de) [default]',
41 'api' => [
42 'oldlanguage' => 'en',
43 'newlanguage' => 'de[def]'
44 ],
45 ],
46 ],
47 ];
48 }
49
53 public function testPageLangLogDatabaseRows( $row, $extra ) {
54 $this->doTestLogFormatter( $row, $extra );
55 }
56}
doTestLogFormatter( $row, $extra)
mergeMwGlobalArrayValue( $name, $values)
Merges the given values into a MW global array variable.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
testPageLangLogDatabaseRows( $row, $extra)
providePageLangLogDatabaseRows
static providePageLangLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility.
const NS_MAIN
Definition Defines.php:74