MediaWiki
REL1_32
CssContentHandlerTest.php
Go to the documentation of this file.
1
<?php
2
3
class
CssContentHandlerTest
extends
MediaWikiLangTestCase
{
4
9
public
function
testMakeRedirectContent
( $title, $expected ) {
10
$this->
setMwGlobals
( [
11
'wgServer'
=>
'//example.org'
,
12
'wgScript'
=>
'/w/index.php'
,
13
] );
14
$ch =
new
CssContentHandler
();
15
$content
= $ch->makeRedirectContent( Title::newFromText( $title ) );
16
$this->assertInstanceOf( CssContent::class,
$content
);
17
$this->assertEquals( $expected,
$content
->serialize(
CONTENT_FORMAT_CSS
) );
18
}
19
23
public
static
function
provideMakeRedirectContent
() {
24
// phpcs:disable Generic.Files.LineLength
25
return
[
26
[
27
'MediaWiki:MonoBook.css'
,
28
"/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);"
29
],
30
[
31
'User:FooBar/common.css'
,
32
"/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);"
33
],
34
[
35
'Gadget:FooBaz.css'
,
36
"/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);"
37
],
38
[
39
'User:😂/unicode.css'
,
40
'/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
41
],
42
];
43
// phpcs:enable
44
}
45
}
CssContentHandlerTest
Definition
CssContentHandlerTest.php:3
CssContentHandlerTest\provideMakeRedirectContent
static provideMakeRedirectContent()
Keep this in sync with CssContentTest::provideGetRedirectTarget()
Definition
CssContentHandlerTest.php:23
CssContentHandlerTest\testMakeRedirectContent
testMakeRedirectContent( $title, $expected)
provideMakeRedirectContent CssContentHandler::makeRedirectContent
Definition
CssContentHandlerTest.php:9
CssContentHandler
Content handler for CSS pages.
Definition
CssContentHandler.php:30
MediaWikiLangTestCase
Base class that store and restore the Language objects.
Definition
MediaWikiLangTestCase.php:8
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition
MediaWikiTestCase.php:706
CONTENT_FORMAT_CSS
const CONTENT_FORMAT_CSS
Definition
Defines.php:254
$content
$content
Definition
pageupdater.txt:72
tests
phpunit
includes
content
CssContentHandlerTest.php
Generated on Mon Nov 25 2024 15:58:36 for MediaWiki by
1.10.0