summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/SanitizerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/SanitizerTest.php')
-rw-r--r--tests/phpunit/includes/SanitizerTest.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php
index 50c1e509..c615c460 100644
--- a/tests/phpunit/includes/SanitizerTest.php
+++ b/tests/phpunit/includes/SanitizerTest.php
@@ -6,12 +6,6 @@
*/
class SanitizerTest extends MediaWikiTestCase {
- protected function setUp() {
- parent::setUp();
-
- AutoLoader::loadClass( 'Sanitizer' );
- }
-
/**
* @covers Sanitizer::decodeCharReferences
*/
@@ -85,7 +79,7 @@ class SanitizerTest extends MediaWikiTestCase {
*/
public function testInvalidNumberedEntities() {
$this->assertEquals(
- UTF8_REPLACEMENT,
+ UtfNormal\Constants::UTF8_REPLACEMENT,
Sanitizer::decodeCharReferences( "�" ),
'Invalid numbered entity'
);
@@ -346,4 +340,25 @@ class SanitizerTest extends MediaWikiTestCase {
$message
);
}
+
+ /**
+ * @dataProvider provideEscapeHtmlAllowEntities
+ * @covers Sanitizer::escapeHtmlAllowEntities
+ */
+ public function testEscapeHtmlAllowEntities( $expected, $html ) {
+ $this->assertEquals(
+ $expected,
+ Sanitizer::escapeHtmlAllowEntities( $html )
+ );
+ }
+
+ public static function provideEscapeHtmlAllowEntities() {
+ return array(
+ array( 'foo', 'foo' ),
+ array( 'a¡b', 'a¡b' ),
+ array( 'foo'bar', "foo'bar" ),
+ array( '&lt;script&gt;foo&lt;/script&gt;', '<script>foo</script>' ),
+ );
+ }
+
}