SECURITY: blacklist CSS var()
[lhc/web/wiklou.git] / tests / phpunit / includes / content / MessageContentTest.php
1 <?php
2
3 /**
4 * @group ContentHandler
5 * @covers MessageContent
6 */
7 class MessageContentTest extends MediaWikiLangTestCase {
8
9 public function testGetHtml() {
10 $msg = new Message( 'about' );
11 $cnt = new MessageContent( $msg );
12
13 $this->assertSame( $msg->parse(), $cnt->getHtml() );
14 }
15
16 public function testGetWikitext() {
17 $msg = new Message( 'about' );
18 $cnt = new MessageContent( $msg );
19
20 $this->assertSame( $msg->text(), $cnt->getWikitext() );
21 }
22
23 public function testGetMessage() {
24 $msg = new Message( 'about' );
25 $cnt = new MessageContent( $msg );
26
27 $this->assertEquals( $msg, $cnt->getMessage() );
28 }
29
30 public function testGetParserOutput() {
31 $msg = new Message( 'about' );
32 $cnt = new MessageContent( $msg );
33
34 $title = Title::makeTitle( NS_MEDIAWIKI, 'about' );
35
36 $this->assertSame( $msg->parse(), $cnt->getParserOutput( $title )->getText() );
37 }
38
39 public function testSerialize() {
40 $msg = new Message( 'about' );
41 $cnt = new MessageContent( $msg );
42
43 $this->assertSame( $msg->plain(), $cnt->serialize() );
44 }
45
46 public function testEquals() {
47 $msg1 = new Message( 'about' );
48 $cnt1 = new MessageContent( $msg1 );
49
50 $msg2 = new Message( 'about' );
51 $cnt2 = new MessageContent( $msg2 );
52
53 $msg3 = new Message( 'faq' );
54 $cnt3 = new MessageContent( $msg3 );
55 $cnt4 = new WikitextContent( $msg3->plain() );
56
57 $this->assertTrue( $cnt1->equals( $cnt2 ) );
58 $this->assertFalse( $cnt1->equals( $cnt3 ) );
59 $this->assertFalse( $cnt1->equals( $cnt4 ) );
60 }
61 }