MediaWiki REL1_32
ResourceLoaderLessVarFileModuleTest.php
Go to the documentation of this file.
1<?php
2
7
8 public static function providerWrapAndEscapeMessage() {
9 return [
10 [
11 "Foo", '"Foo"',
12 ],
13 [
14 "Foo bananas", '"Foo bananas"',
15 ],
16 [
17 "Who's that test? Who's that test? It's Jess!",
18 '"Who\\\'s that test? Who\\\'s that test? It\\\'s Jess!"',
19 ],
20 [
21 'Hello "he" said',
22 '"Hello \"he\" said"',
23 ],
24 [
25 'boo";-o-link:javascript:alert(1);color:red;content:"',
26 '"boo\";-o-link:javascript:alert(1);color:red;content:\""',
27 ],
28 [
29 '"jon\'s"',
30 '"\"jon\\\'s\""'
31 ]
32 ];
33 }
38 public function testEscapeMessage( $msg, $expected ) {
39 $method = new ReflectionMethod( ResourceLoaderLessVarFileModule::class, 'wrapAndEscapeMessage' );
40 $method->setAccessible( true );
41 $this->assertEquals( $expected, $method->invoke( null, $msg ) );
42 }
43}
testEscapeMessage( $msg, $expected)
providerWrapAndEscapeMessage ResourceLoaderLessVarFileModule::wrapAndEscapeMessage