Fix improper parameters to ReflectionMethod::invoke
[lhc/web/wiklou.git] / tests / phpunit / includes / resourceloader / ResourceLoaderLessVarFileModuleTest.php
1 <?php
2
3 /**
4 * @group ResourceLoader
5 */
6 class ResourceLoaderLessVarFileModuleTest extends ResourceLoaderTestCase {
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 }
34 /**
35 * @dataProvider providerWrapAndEscapeMessage
36 * @covers ResourceLoaderLessVarFileModule::wrapAndEscapeMessage
37 */
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 }