MediaWiki  1.23.14
CssContentTest.php
Go to the documentation of this file.
1 <?php
2 
9 
10  protected function setUp() {
11  parent::setUp();
12 
13  // Anon user
14  $user = new User();
15  $user->setName( '127.0.0.1' );
16 
17  $this->setMwGlobals( array(
18  'wgUser' => $user,
19  'wgTextModelsToParse' => array(
21  )
22  ) );
23  }
24 
25  public function newContent( $text ) {
26  return new CssContent( $text );
27  }
28 
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>"
36  ),
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 )
45  )
46  )
47  ),
48 
49  // TODO: more...?
50  );
51  }
52 
56  public function testGetModel() {
57  $content = $this->newContent( 'hello world.' );
58 
59  $this->assertEquals( CONTENT_MODEL_CSS, $content->getModel() );
60  }
61 
65  public function testGetContentHandler() {
66  $content = $this->newContent( 'hello world.' );
67 
68  $this->assertEquals( CONTENT_MODEL_CSS, $content->getContentHandler()->getModelID() );
69  }
70 
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 ),
77  );
78  }
79 
84  public function testEquals( Content $a, Content $b = null, $equal = false ) {
85  $this->assertEquals( $equal, $a->equals( $b ) );
86  }
87 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
CssContentTest\testGetContentHandler
testGetContentHandler()
@covers CssContent::getContentHandler
Definition: CssContentTest.php:65
CONTENT_MODEL_CSS
const CONTENT_MODEL_CSS
Definition: Defines.php:285
CssContentTest\testEquals
testEquals(Content $a, Content $b=null, $equal=false)
@dataProvider dataEquals @covers CssContent::equals
Definition: CssContentTest.php:84
CssContentTest\dataGetParserOutput
static dataGetParserOutput()
Definition: CssContentTest.php:29
CssContent
Content object for CSS pages.
Definition: CssContent.php:33
CssContentTest\newContent
newContent( $text)
Definition: CssContentTest.php:25
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
WikitextContent
Content object for wiki text pages.
Definition: WikitextContent.php:33
Content\equals
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object.
CssContentTest
@group ContentHandler @group Database ^— needed, because we do need the database to test link updates
Definition: CssContentTest.php:8
CssContentTest\testGetModel
testGetModel()
@covers CssContent::getModel
Definition: CssContentTest.php:56
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
Content
Base interface for content objects.
Definition: Content.php:34
User
User
Definition: All_system_messages.txt:425
CssContentTest\dataEquals
static dataEquals()
Definition: CssContentTest.php:71
CssContentTest\setUp
setUp()
Definition: CssContentTest.php:10