X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flogging%2FLogFormatterTest.php;h=9650fb1b34376f6d7ff1d2356725b28a3db48cdd;hb=7ab94d37bb200481a929edd03f6cf3279efbf224;hp=d6cbbee26d73993cf6281ec04a97d2eb41315f3e;hpb=8b5bfd8b88e4c2fa58db00b250964878fb2828b2;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/logging/LogFormatterTest.php b/tests/phpunit/includes/logging/LogFormatterTest.php index d6cbbee26d..9650fb1b34 100755 --- a/tests/phpunit/includes/logging/LogFormatterTest.php +++ b/tests/phpunit/includes/logging/LogFormatterTest.php @@ -29,7 +29,7 @@ class LogFormatterTest extends MediaWikiLangTestCase { 'wgLogActionsHandlers' => array( 'phpunit/test' => 'LogFormatter', 'phpunit/param' => 'LogFormatter' ), 'wgUser' => User::newFromName( 'Testuser' ), - 'wgExtensionMessagesFiles' => array( 'LogTests' => __DIR__.'/LogTests.i18n.php' ), + 'wgExtensionMessagesFiles' => array( 'LogTests' => __DIR__ . '/LogTests.i18n.php' ), ) ); $wgLang->getLocalisationCache()->recache( $wgLang->getCode() ); @@ -43,6 +43,13 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->context->setLanguage( $wgLang ); } + protected function tearDown() { + parent::tearDown(); + + global $wgLang; + $wgLang->getLocalisationCache()->recache( $wgLang->getCode() ); + } + public function newLogEntry( $action, $params ) { $logEntry = new ManualLogEntry( 'phpunit', $action ); $logEntry->setPerformer( $this->user ); @@ -54,6 +61,9 @@ class LogFormatterTest extends MediaWikiLangTestCase { return $logEntry; } + /** + * @covers LogFormatter::newFromEntry + */ public function testNormalLogParams() { $entry = $this->newLogEntry( 'test', array() ); $formatter = LogFormatter::newFromEntry( $entry ); @@ -92,6 +102,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $titleLink, $paramsWithoutTools[2]['raw'] ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeRaw() { $params = array( '4:raw:raw' => Linker::link( $this->title, null, array(), array() ) ); $expected = Linker::link( $this->title, null, array(), array() ); @@ -105,6 +119,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeMsg() { $params = array( '4:msg:msg' => 'log-description-phpunit' ); $expected = wfMessage( 'log-description-phpunit' )->text(); @@ -118,6 +136,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeMsgContent() { $params = array( '4:msg-content:msgContent' => 'log-description-phpunit' ); $expected = wfMessage( 'log-description-phpunit' )->inContentLanguage()->text(); @@ -131,6 +153,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeNumber() { global $wgLang; @@ -146,6 +172,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeUserLink() { $params = array( '4:user-link:userLink' => $this->user->getName() ); $expected = Linker::userLink( @@ -162,6 +192,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypeTitleLink() { $params = array( '4:title-link:titleLink' => $this->title->getText() ); $expected = Linker::link( $this->title, null, array(), array() ); @@ -175,6 +209,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getActionText + */ public function testLogParamsTypePlain() { $params = array( '4:plain:plain' => 'Some plain text' ); $expected = 'Some plain text'; @@ -188,6 +226,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $logParam ); } + /** + * @covers LogFormatter::newFromEntry + * @covers LogFormatter::getComment + */ public function testLogComment() { $entry = $this->newLogEntry( 'test', array() ); $formatter = LogFormatter::newFromEntry( $entry );