MediaWiki REL1_30
PageLangLogFormatterTest.php
Go to the documentation of this file.
1<?php
2
4
5 protected function setUp() {
6 parent::setUp();
7
8 // Disable cldr extension
9 $this->setMwGlobals( 'wgHooks', [] );
10 // Register LogHandler, see $wgPageLanguageUseDB in Setup.php
11 $this->mergeMwGlobalArrayValue( 'wgLogActionsHandlers', [
12 'pagelang/pagelang' => 'PageLangLogFormatter',
13 ] );
14 }
15
21 public static function providePageLangLogDatabaseRows() {
22 return [
23 // Current format
24 [
25 [
26 'type' => 'pagelang',
27 'action' => 'pagelang',
28 'comment' => 'page lang comment',
29 'namespace' => NS_MAIN,
30 'title' => 'Page',
31 'params' => [
32 '4::oldlanguage' => 'en',
33 '5::newlanguage' => 'de[def]',
34 ],
35 ],
36 [
37 'text' => 'User changed the language of Page from English (en) to Deutsch (de) [default]',
38 'api' => [
39 'oldlanguage' => 'en',
40 'newlanguage' => 'de[def]'
41 ],
42 ],
43 ],
44 ];
45 }
46
50 public function testPageLangLogDatabaseRows( $row, $extra ) {
51 $this->doTestLogFormatter( $row, $extra );
52 }
53}
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:65