jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/391347 )
Change subject: SanitizerTest: Add tests for stripAllTags
......................................................................
SanitizerTest: Add tests for stripAllTags
Bug: T179978
Change-Id: I9776cfd51b1b3ec772d4216168fbe466f48f5892
---
M tests/phpunit/includes/SanitizerTest.php
1 file changed, 28 insertions(+), 0 deletions(-)
Approvals:
Tim Starling: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/includes/SanitizerTest.php
b/tests/phpunit/includes/SanitizerTest.php
index 6fc25df..269575b 100644
--- a/tests/phpunit/includes/SanitizerTest.php
+++ b/tests/phpunit/includes/SanitizerTest.php
@@ -513,6 +513,34 @@
}
/**
+ * @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 [
+ [ '<p>Foo</p>', 'Foo' ],
+ [ '<p id="one">Foo</p><p id="two">Bar</p>', 'FooBar' ],
+ [ "<p>Foo</p>\n<p>Bar</p>", 'Foo Bar' ],
+ [ '<p>Hello <strong> world
café</p>', 'Hello <strong> world cafĂ©' ],
+ // This one is broken, see T179978
+ //[
+ // '<p><small data-foo=\'bar"<baz>quux\'><a
href="./Foo">Bar</a></small> Whee!</p>',
+ // 'Bar Whee!'
+ //],
+ [ '1<span class="<?php">2</span>3', '123' ],
+ [ '1<span class="<?">2</span>3', '123' ],
+ ];
+ }
+
+ /**
* @expectedException InvalidArgumentException
* @covers Sanitizer::escapeIdInternal()
*/
--
To view, visit https://gerrit.wikimedia.org/r/391347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9776cfd51b1b3ec772d4216168fbe466f48f5892
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits