From: Marius Hoch Date: Wed, 14 Jan 2015 23:22:06 +0000 (+0100) Subject: Add tests for Sanitizer::escapeHtmlAllowEntities X-Git-Tag: 1.31.0-rc.0~12671^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=65d798de5d38db1132547c781f8caf59bc7125b9;p=lhc%2Fweb%2Fwiklou.git Add tests for Sanitizer::escapeHtmlAllowEntities Change-Id: I84a1328559d57a424aa77a6d89f837615feffc13 --- 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>', '' ), + ); + } + }