wiki.techinc.nl/tests/phpunit/includes/logging/PageLangLogFormatterTest.php
Kunal Mehta 6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00

53 lines
1.2 KiB
PHP

<?php
class PageLangLogFormatterTest extends LogFormatterTestCase {
protected function setUp() {
parent::setUp();
// Disable cldr extension
$this->setMwGlobals( 'wgHooks', [] );
// Register LogHandler, see $wgPageLanguageUseDB in Setup.php
$this->mergeMwGlobalArrayValue( 'wgLogActionsHandlers', [
'pagelang/pagelang' => 'PageLangLogFormatter',
] );
}
/**
* Provide different rows from the logging table to test
* for backward compatibility.
* Do not change the existing data, just add a new database row
*/
public static function providePageLangLogDatabaseRows() {
return [
// Current format
[
[
'type' => 'pagelang',
'action' => 'pagelang',
'comment' => 'page lang comment',
'namespace' => NS_MAIN,
'title' => 'Page',
'params' => [
'4::oldlanguage' => 'en',
'5::newlanguage' => 'de[def]',
],
],
[
'text' => 'User changed the language of Page from English (en) to Deutsch (de) [default]',
'api' => [
'oldlanguage' => 'en',
'newlanguage' => 'de[def]'
],
],
],
];
}
/**
* @dataProvider providePageLangLogDatabaseRows
*/
public function testPageLangLogDatabaseRows( $row, $extra ) {
$this->doTestLogFormatter( $row, $extra );
}
}