3 use MediaWiki\Content\CssContent
;
4 use MediaWiki\Content\CssContentHandler
;
5 use MediaWiki\MainConfigNames
;
6 use MediaWiki\Title\Title
;
9 * @covers \MediaWiki\Content\CssContentHandler
11 class CssContentHandlerTest
extends MediaWikiLangTestCase
{
14 * @dataProvider provideMakeRedirectContent
16 public function testMakeRedirectContent( int $namespace, string $title, $expected ) {
17 $this->overrideConfigValues( [
18 MainConfigNames
::Server
=> '//example.org',
19 MainConfigNames
::Script
=> '/w/index.php',
21 $ch = new CssContentHandler();
22 $content = $ch->makeRedirectContent( Title
::makeTitle( $namespace, $title ) );
23 $this->assertInstanceOf( CssContent
::class, $content );
24 $this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_CSS
) );
28 * Keep this in sync with CssContentTest::provideGetRedirectTarget()
30 public static function provideMakeRedirectContent() {
35 "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);"
40 "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);"
45 '/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'