From ce538a60a79fc9334fe63d5ad960d47141494893 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 14 Nov 2017 14:16:14 -0800 Subject: [PATCH] SanitizerTest: Add tests for stripAllTags Bug: T179978 Change-Id: I9776cfd51b1b3ec772d4216168fbe466f48f5892 --- tests/phpunit/includes/SanitizerTest.php | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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() -- 2.20.1