4 * @group ContentHandler
5 * @covers MessageContent
7 class MessageContentTest
extends MediaWikiLangTestCase
{
9 public function testGetHtml() {
10 $msg = new Message( 'about' );
11 $cnt = new MessageContent( $msg );
13 $this->assertSame( $msg->parse(), $cnt->getHtml() );
16 public function testGetWikitext() {
17 $msg = new Message( 'about' );
18 $cnt = new MessageContent( $msg );
20 $this->assertSame( $msg->text(), $cnt->getWikitext() );
23 public function testGetMessage() {
24 $msg = new Message( 'about' );
25 $cnt = new MessageContent( $msg );
27 $this->assertEquals( $msg, $cnt->getMessage() );
30 public function testGetParserOutput() {
31 $msg = new Message( 'about' );
32 $cnt = new MessageContent( $msg );
34 $title = Title
::makeTitle( NS_MEDIAWIKI
, 'about' );
36 $this->assertSame( $msg->parse(), $cnt->getParserOutput( $title )->getText() );
39 public function testSerialize() {
40 $msg = new Message( 'about' );
41 $cnt = new MessageContent( $msg );
43 $this->assertSame( $msg->plain(), $cnt->serialize() );
46 public function testEquals() {
47 $msg1 = new Message( 'about' );
48 $cnt1 = new MessageContent( $msg1 );
50 $msg2 = new Message( 'about' );
51 $cnt2 = new MessageContent( $msg2 );
53 $msg3 = new Message( 'faq' );
54 $cnt3 = new MessageContent( $msg3 );
55 $cnt4 = new WikitextContent( $msg3->plain() );
57 $this->assertTrue( $cnt1->equals( $cnt2 ) );
58 $this->assertFalse( $cnt1->equals( $cnt3 ) );
59 $this->assertFalse( $cnt1->equals( $cnt4 ) );