wiki.techinc.nl/tests/phpunit/includes/content/CssContentHandlerTest.php
umherirrender e386a46eb3 Fix some language depending phpunit tests by using MediaWikiLangTestCase
Some tests fails on wikis with $wgLanguageCode not = 'en', fix this by
setting the correct language context.

Change-Id: Ia72017df59d8beb5c508832584b2431ffab0f77f
2015-12-07 17:26:16 +01:00

32 lines
1.2 KiB
PHP

<?php
class CssContentHandlerTest extends MediaWikiLangTestCase {
/**
* @dataProvider provideMakeRedirectContent
* @covers CssContentHandler::makeRedirectContent
*/
public function testMakeRedirectContent( $title, $expected ) {
$this->setMwGlobals( array(
'wgServer' => '//example.org',
'wgScript' => '/w/index.php',
) );
$ch = new CssContentHandler();
$content = $ch->makeRedirectContent( Title::newFromText( $title ) );
$this->assertInstanceOf( 'CssContent', $content );
$this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_CSS ) );
}
/**
* Keep this in sync with CssContentTest::provideGetRedirectTarget()
*/
public static function provideMakeRedirectContent() {
// @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array( 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ),
array( 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ),
array( 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ),
);
// @codingStandardsIgnoreEnd
}
}