wiki.techinc.nl/tests/phpunit/includes/content/CssContentHandlerTest.php
Derick Alangi 6e5f2d0822 tests: Migrate setMwGlobals() to overrideConfigValue(s)()
Directories covered are:
- tests/phpunit/includes/cache/
- tests/phpunit/includes/changes/
- tests/phpunit/includes/changetags/
- tests/phpunit/includes/config/
- tests/phpunit/includes/content/
- tests/phpunit/includes/debug/
- tests/phpunit/includes/deferred/
- tests/phpunit/includes/diff/

Change-Id: I3a1f586867db7d57b177e13a03a4593f7eed09f4
2022-07-23 05:53:49 +01:00

46 lines
1.4 KiB
PHP

<?php
use MediaWiki\MainConfigNames;
class CssContentHandlerTest extends MediaWikiLangTestCase {
/**
* @dataProvider provideMakeRedirectContent
* @covers CssContentHandler::makeRedirectContent
*/
public function testMakeRedirectContent( $title, $expected ) {
$this->overrideConfigValues( [
MainConfigNames::Server => '//example.org',
MainConfigNames::Script => '/w/index.php',
] );
$ch = new CssContentHandler();
$content = $ch->makeRedirectContent( Title::newFromText( $title ) );
$this->assertInstanceOf( CssContent::class, $content );
$this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_CSS ) );
}
/**
* Keep this in sync with CssContentTest::provideGetRedirectTarget()
*/
public static function provideMakeRedirectContent() {
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);"
],
[
'User:😂/unicode.css',
'/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
],
];
// phpcs:enable
}
}