From: C. Scott Ananian Date: Thu, 27 Sep 2018 15:05:47 +0000 (-0400) Subject: Add basic test cases for OutputPage::addWikiMsg / wrapWikiMsg X-Git-Tag: 1.34.0-rc.0~3973 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=f6081797f33101be9220b84819c785349cc69ebb;p=lhc%2Fweb%2Fwiklou.git Add basic test cases for OutputPage::addWikiMsg / wrapWikiMsg Change-Id: I621c22f2819b426ce6088ff3bdf1dadca274d1f9 --- diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 9d6122d97b..283e99fc93 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -1508,6 +1508,36 @@ class OutputPageTest extends MediaWikiTestCase { $op->addWikiText( 'a' ); } + /** + * @covers OutputPage::addWikiMsg + */ + public function testAddWikiMsg() { + $msg = wfMessage( 'parentheses' ); + $this->assertSame( '(a)', $msg->rawParams( 'a' )->plain() ); + + $op = $this->newInstance(); + $this->assertSame( '', $op->getHTML() ); + $op->addWikiMsg( 'parentheses', "a" ); + // This is known to be bad unbalanced HTML; this will be fixed + // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214) + $this->assertSame( "

(a)\n

", $op->getHTML() ); + } + + /** + * @covers OutputPage::wrapWikiMsg + */ + public function testWrapWikiMsg() { + $msg = wfMessage( 'parentheses' ); + $this->assertSame( '(a)', $msg->rawParams( 'a' )->plain() ); + + $op = $this->newInstance(); + $this->assertSame( '', $op->getHTML() ); + $op->wrapWikiMsg( '[$1]', [ 'parentheses', "a" ] ); + // This is known to be bad unbalanced HTML; this will be fixed + // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214) + $this->assertSame( "

[(a)]\n

", $op->getHTML() ); + } + /** * @covers OutputPage::addParserOutputMetadata */