diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:15:42 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:44:51 +0100 |
commit | a1789ddde42033f1b05cc4929491214ee6e79383 (patch) | |
tree | 63615735c4ddffaaabf2428946bb26f90899f7bf /tests/phpunit/includes/logging/PageLangLogFormatterTest.php | |
parent | 9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff) |
Update to MediaWiki 1.26.0
Diffstat (limited to 'tests/phpunit/includes/logging/PageLangLogFormatterTest.php')
-rw-r--r-- | tests/phpunit/includes/logging/PageLangLogFormatterTest.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/phpunit/includes/logging/PageLangLogFormatterTest.php b/tests/phpunit/includes/logging/PageLangLogFormatterTest.php new file mode 100644 index 00000000..226e492b --- /dev/null +++ b/tests/phpunit/includes/logging/PageLangLogFormatterTest.php @@ -0,0 +1,53 @@ +<?php + +class PageLangLogFormatterTest extends LogFormatterTestCase { + + protected function setUp() { + parent::setUp(); + + // Disable cldr extension + $this->setMwGlobals( 'wgHooks', array() ); + // Register LogHandler, see $wgPageLanguageUseDB in Setup.php + $this->mergeMwGlobalArrayValue( 'wgLogActionsHandlers', array( + '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 array( + // Current format + array( + array( + 'type' => 'pagelang', + 'action' => 'pagelang', + 'comment' => 'page lang comment', + 'namespace' => NS_MAIN, + 'title' => 'Page', + 'params' => array( + '4::oldlanguage' => 'en', + '5::newlanguage' => 'de[def]', + ), + ), + array( + 'text' => 'User changed page language for Page from English (en) to Deutsch (de) [default].', + 'api' => array( + 'oldlanguage' => 'en', + 'newlanguage' => 'de[def]' + ), + ), + ), + ); + } + + /** + * @dataProvider providePageLangLogDatabaseRows + */ + public function testPageLangLogDatabaseRows( $row, $extra ) { + $this->doTestLogFormatter( $row, $extra ); + } +} |