wiki.techinc.nl/tests/phpunit/includes/resourceloader/ResourceLoaderLessVarFileModuleTest.php
Thiemo Kreuz c3dfa88966 Add missing empty lines between methods
This might hint at an edge-case in the PHP CodeSniffer sniff that should
detect if methods are separated by a single empty line. Feel free to
investigate. I, personally, can't invest more time in this than
suggesting this quick fix.

Change-Id: Ib3c60eac76f255b4fe929f7933de256222716576
2019-01-15 19:14:35 +00:00

44 lines
1 KiB
PHP

<?php
/**
* @group ResourceLoader
*/
class ResourceLoaderLessVarFileModuleTest extends ResourceLoaderTestCase {
public static function providerWrapAndEscapeMessage() {
return [
[
"Foo", '"Foo"',
],
[
"Foo bananas", '"Foo bananas"',
],
[
"Who's that test? Who's that test? It's Jess!",
'"Who\\\'s that test? Who\\\'s that test? It\\\'s Jess!"',
],
[
'Hello "he" said',
'"Hello \"he\" said"',
],
[
'boo";-o-link:javascript:alert(1);color:red;content:"',
'"boo\";-o-link:javascript:alert(1);color:red;content:\""',
],
[
'"jon\'s"',
'"\"jon\\\'s\""'
]
];
}
/**
* @dataProvider providerWrapAndEscapeMessage
* @covers ResourceLoaderLessVarFileModule::wrapAndEscapeMessage
*/
public function testEscapeMessage( $msg, $expected ) {
$method = new ReflectionMethod( ResourceLoaderLessVarFileModule::class, 'wrapAndEscapeMessage' );
$method->setAccessible( true );
$this->assertEquals( $expected, $method->invoke( null, $msg ) );
}
}