mediawiki.api: Adopt async-await and assert.rejects() in various tests
[mediawiki.git] / tests / phpunit / includes / content / CssContentHandlerTest.php
blobfb838bb5a0f479bff5ec46e40e2facec3fa47749
1 <?php
3 use MediaWiki\Content\CssContent;
4 use MediaWiki\Content\CssContentHandler;
5 use MediaWiki\MainConfigNames;
6 use MediaWiki\Title\Title;
8 /**
9 * @covers \MediaWiki\Content\CssContentHandler
11 class CssContentHandlerTest extends MediaWikiLangTestCase {
13 /**
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',
20 ] );
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 ) );
27 /**
28 * Keep this in sync with CssContentTest::provideGetRedirectTarget()
30 public static function provideMakeRedirectContent() {
31 return [
33 NS_MEDIAWIKI,
34 'MonoBook.css',
35 "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);"
38 NS_USER,
39 'FooBar/common.css',
40 "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);"
43 NS_USER,
44 '😂/unicode.css',
45 '/* #REDIRECT */@import url(//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.css&action=raw&ctype=text/css);'
48 // phpcs:enable