From: Roan Kattouw Date: Tue, 14 Nov 2017 22:16:14 +0000 (-0800) Subject: SanitizerTest: Add tests for stripAllTags X-Git-Tag: 1.31.0-rc.0~1480^2~2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_modifier.php?a=commitdiff_plain;h=ce538a60a79fc9334fe63d5ad960d47141494893;p=lhc%2Fweb%2Fwiklou.git SanitizerTest: Add tests for stripAllTags Bug: T179978 Change-Id: I9776cfd51b1b3ec772d4216168fbe466f48f5892 --- diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php index 6fc25df070..269575b24e 100644 --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@ -512,6 +512,34 @@ class SanitizerTest extends MediaWikiTestCase { ]; } + /** + * @dataProvider provideStripAllTags + * + * @covers Sanitizer::stripAllTags() + * + * @param string $input + * @param string $expected + */ + public function testStripAllTags( $input, $expected ) { + $this->assertEquals( $expected, Sanitizer::stripAllTags( $input ) ); + } + + public function provideStripAllTags() { + return [ + [ '

Foo

', 'Foo' ], + [ '

Foo

Bar

', 'FooBar' ], + [ "

Foo

\n

Bar

", 'Foo Bar' ], + [ '

Hello <strong> world café

', 'Hello world café' ], + // This one is broken, see T179978 + //[ + // '

quux\'>Bar Whee!

', + // 'Bar Whee!' + //], + [ '123', '123' ], + [ '123', '123' ], + ]; + } + /** * @expectedException InvalidArgumentException * @covers Sanitizer::escapeIdInternal()