MediaWiki REL1_30
HtmlArmorTest.php
Go to the documentation of this file.
1<?php
2
6class HtmlArmorTest extends PHPUnit_Framework_TestCase {
7
8 public static function provideHtmlArmor() {
9 return [
10 [
11 'foobar',
12 'foobar',
13 ],
14 [
15 '<script>alert("evil!");</script>',
16 '&lt;script&gt;alert(&quot;evil!&quot;);&lt;/script&gt;',
17 ],
18 [
19 new HtmlArmor( '<script>alert("evil!");</script>' ),
20 '<script>alert("evil!");</script>',
21 ],
22 ];
23 }
24
28 public function testHtmlArmor( $input, $expected ) {
29 $this->assertEquals(
30 $expected,
31 HtmlArmor::getHtml( $input )
32 );
33 }
34}
testHtmlArmor( $input, $expected)
provideHtmlArmor
static provideHtmlArmor()
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:28
if(is_array($mode)) switch( $mode) $input