MediaWiki  1.33.0
Go to the documentation of this file.
1 <?php
8  protected function setUp() {
9  parent::setUp();
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  }
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  }
53  public function testPageLangLogDatabaseRows( $row, $extra ) {
54  $this->doTestLogFormatter( $row, $extra );
55  }
56 }
testPageLangLogDatabaseRows( $row, $extra)
Definition: PageLangLogFormatterTest.php:53
mergeMwGlobalArrayValue( $name, $values)
Merges the given values into a MW global array variable.
Definition: MediaWikiTestCase.php:904
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const NS_MAIN
Definition: Defines.php:64
Definition: LogFormatterTestCase.php:6
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition: MediaWikiTestCase.php:709
static providePageLangLogDatabaseRows()
Provide different rows from the logging table to test for backward compatibility.
Definition: PageLangLogFormatterTest.php:24
Definition: PageLangLogFormatterTest.php:8
doTestLogFormatter( $row, $extra)
Definition: LogFormatterTestCase.php:8
Definition: PageLangLogFormatterTest.php:6
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52