Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / tests / phpunit / includes / content / CssContentTest.php
blob40484d3a0eb9604e2d49d52dbba8ec73e0cc4895
1 <?php
3 /**
4 * @group ContentHandler
5 * @group Database
6 * ^--- needed, because we do need the database to test link updates
7 */
8 class CssContentTest extends JavaScriptContentTest {
10 protected function setUp() {
11 parent::setUp();
13 // Anon user
14 $user = new User();
15 $user->setName( '127.0.0.1' );
17 $this->setMwGlobals( array(
18 'wgUser' => $user,
19 'wgTextModelsToParse' => array(
20 CONTENT_MODEL_CSS,
22 ) );
25 public function newContent( $text ) {
26 return new CssContent( $text );
29 public static function dataGetParserOutput() {
30 return array(
31 array(
32 'MediaWiki:Test.css',
33 null,
34 "hello <world>\n",
35 "<pre class=\"mw-code mw-css\" dir=\"ltr\">\nhello &lt;world&gt;\n\n</pre>"
37 array(
38 'MediaWiki:Test.css',
39 null,
40 "/* hello [[world]] */\n",
41 "<pre class=\"mw-code mw-css\" dir=\"ltr\">\n/* hello [[world]] */\n\n</pre>",
42 array(
43 'Links' => array(
44 array( 'World' => 0 )
49 // TODO: more...?
53 /**
54 * @covers CssContent::getModel
56 public function testGetModel() {
57 $content = $this->newContent( 'hello world.' );
59 $this->assertEquals( CONTENT_MODEL_CSS, $content->getModel() );
62 /**
63 * @covers CssContent::getContentHandler
65 public function testGetContentHandler() {
66 $content = $this->newContent( 'hello world.' );
68 $this->assertEquals( CONTENT_MODEL_CSS, $content->getContentHandler()->getModelID() );
71 public static function dataEquals() {
72 return array(
73 array( new CssContent( 'hallo' ), null, false ),
74 array( new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ),
75 array( new CssContent( 'hallo' ), new WikitextContent( 'hallo' ), false ),
76 array( new CssContent( 'hallo' ), new CssContent( 'HALLO' ), false ),
80 /**
81 * @dataProvider dataEquals
82 * @covers CssContent::equals
84 public function testEquals( Content $a, Content $b = null, $equal = false ) {
85 $this->assertEquals( $equal, $a->equals( $b ) );