From 65d798de5d38db1132547c781f8caf59bc7125b9 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Thu, 15 Jan 2015 00:22:06 +0100 Subject: [PATCH] Add tests for Sanitizer::escapeHtmlAllowEntities Change-Id: I84a1328559d57a424aa77a6d89f837615feffc13 --- tests/phpunit/includes/SanitizerTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php index f960f48455..36ad3cc17c 100644 --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@ -340,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( '<script>foo</script>', '' ), + ); + } + } -- 2.20.1