MediaWiki REL1_33
JavaScriptContentHandlerTest.php
Go to the documentation of this file.
1<?php
2
4
9 public function testMakeRedirectContent( $title, $expected ) {
10 $this->setMwGlobals( [
11 'wgServer' => '//example.org',
12 'wgScript' => '/w/index.php',
13 ] );
14 $ch = new JavaScriptContentHandler();
15 $content = $ch->makeRedirectContent( Title::newFromText( $title ) );
16 $this->assertInstanceOf( JavaScriptContent::class, $content );
17 $this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_JAVASCRIPT ) );
18 }
19
23 public static function provideMakeRedirectContent() {
24 // phpcs:disable Generic.Files.LineLength
25 return [
26 [
27 'MediaWiki:MonoBook.js',
28 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");'
29 ],
30 [
31 'User:FooBar/common.js',
32 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");'
33 ],
34 [
35 'Gadget:FooBaz.js',
36 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
37 ],
38 [
39 'User:😂/unicode.js',
40 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:%F0%9F%98%82/unicode.js\u0026action=raw\u0026ctype=text/javascript");'
41 ],
42 ];
43 // phpcs:enable
44 }
45}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testMakeRedirectContent( $title, $expected)
provideMakeRedirectContent JavaScriptContentHandler::makeRedirectContent
static provideMakeRedirectContent()
Keep this in sync with JavaScriptContentTest::provideGetRedirectTarget()
Content handler for JavaScript pages.
Base class that store and restore the Language objects.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
const CONTENT_FORMAT_JAVASCRIPT
Definition Defines.php:261
$content