4 * @group ContentHandler
6 class MessageContentTest
extends MediaWikiLangTestCase
{
8 public function testGetHtml() {
9 $msg = new Message( 'about' );
10 $cnt = new MessageContent( $msg );
12 $this->assertSame( $msg->parse(), $cnt->getHtml() );
15 public function testGetWikitext() {
16 $msg = new Message( 'about' );
17 $cnt = new MessageContent( $msg );
19 $this->assertSame( $msg->text(), $cnt->getWikitext() );
22 public function testGetMessage() {
23 $msg = new Message( 'about' );
24 $cnt = new MessageContent( $msg );
26 $this->assertEquals( $msg, $cnt->getMessage() );
29 public function testGetParserOutput() {
30 $msg = new Message( 'about' );
31 $cnt = new MessageContent( $msg );
33 $title = Title
::makeTitle( NS_MEDIAWIKI
, 'about' );
35 $this->assertSame( $msg->parse(), $cnt->getParserOutput( $title )->getText() );
38 public function testSerialize() {
39 $msg = new Message( 'about' );
40 $cnt = new MessageContent( $msg );
42 $this->assertSame( $msg->plain(), $cnt->serialize() );
45 public function testEquals() {
46 $msg1 = new Message( 'about' );
47 $cnt1 = new MessageContent( $msg1 );
49 $msg2 = new Message( 'about' );
50 $cnt2 = new MessageContent( $msg2 );
52 $msg3 = new Message( 'faq' );
53 $cnt3 = new MessageContent( $msg3 );
54 $cnt4 = new WikitextContent( $msg3->plain() );
56 $this->assertTrue( $cnt1->equals( $cnt2 ) );
57 $this->assertFalse( $cnt1->equals( $cnt3 ) );
58 $this->assertFalse( $cnt1->equals( $cnt4 ) );