test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / includes / content / CssContentTest.php
blob1c458203c779207044549148e27b2fb39c073c22
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 MediaWikiTestCase {
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 public function testGetModel() {
54 $content = $this->newContent( 'hello world.' );
56 $this->assertEquals( CONTENT_MODEL_CSS, $content->getModel() );
59 public function testGetContentHandler() {
60 $content = $this->newContent( 'hello world.' );
62 $this->assertEquals( CONTENT_MODEL_CSS, $content->getContentHandler()->getModelID() );
65 public static function dataEquals() {
66 return array(
67 array( new CssContent( 'hallo' ), null, false ),
68 array( new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ),
69 array( new CssContent( 'hallo' ), new WikitextContent( 'hallo' ), false ),
70 array( new CssContent( 'hallo' ), new CssContent( 'HALLO' ), false ),
74 /**
75 * @dataProvider dataEquals
77 public function testEquals( Content $a, Content $b = null, $equal = false ) {
78 $this->assertEquals( $equal, $a->equals( $b ) );