2015-07-19 16:16:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
2015-12-07 16:26:16 +00:00
|
|
|
class CssContentHandlerTest extends MediaWikiLangTestCase {
|
2015-07-19 16:16:16 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideMakeRedirectContent
|
|
|
|
|
* @covers CssContentHandler::makeRedirectContent
|
|
|
|
|
*/
|
|
|
|
|
public function testMakeRedirectContent( $title, $expected ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->setMwGlobals( [
|
2015-07-19 16:16:16 +00:00
|
|
|
'wgServer' => '//example.org',
|
|
|
|
|
'wgScript' => '/w/index.php',
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2015-07-19 16:16:16 +00:00
|
|
|
$ch = new CssContentHandler();
|
|
|
|
|
$content = $ch->makeRedirectContent( Title::newFromText( $title ) );
|
2018-01-13 00:02:09 +00:00
|
|
|
$this->assertInstanceOf( CssContent::class, $content );
|
2015-07-19 16:16:16 +00:00
|
|
|
$this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_CSS ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Keep this in sync with CssContentTest::provideGetRedirectTarget()
|
|
|
|
|
*/
|
|
|
|
|
public static function provideMakeRedirectContent() {
|
2018-01-01 13:10:16 +00:00
|
|
|
// phpcs:disable Generic.Files.LineLength
|
2016-03-19 01:05:19 +00:00
|
|
|
return [
|
|
|
|
|
[
|
|
|
|
|
'MediaWiki:MonoBook.css',
|
|
|
|
|
"/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'User:FooBar/common.css',
|
|
|
|
|
"/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'Gadget:FooBaz.css',
|
|
|
|
|
"/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);"
|
|
|
|
|
],
|
2018-10-30 02:30:59 +00:00
|
|
|
[
|
|
|
|
|
'User:😂/unicode.css',
|
|
|
|
|
'/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
|
|
|
|
|
],
|
2016-03-19 01:05:19 +00:00
|
|
|
];
|
2018-01-01 13:10:16 +00:00
|
|
|
// phpcs:enable
|
2015-07-19 16:16:16 +00:00
|
|
|
}
|
|
|
|
|
}
|