MediaWiki
REL1_31
HtmlArmorTest.php
Go to the documentation of this file.
1
<?php
2
6
class
HtmlArmorTest
extends
PHPUnit\Framework\TestCase {
7
8
use MediaWikiCoversValidator;
9
10
public
static
function
provideConstructor
() {
11
return
[
12
[
'test'
],
13
[ null ],
14
[
'<em>some html!</em>'
]
15
];
16
}
17
21
public
function
testConstructor
(
$value
) {
22
$this->assertInstanceOf( HtmlArmor::class,
new
HtmlArmor
(
$value
) );
23
}
24
25
public
static
function
provideGetHtml
() {
26
return
[
27
[
28
'foobar'
,
29
'foobar'
,
30
],
31
[
32
'<script>alert("evil!");</script>'
,
33
'<script>alert("evil!");</script>'
,
34
],
35
[
36
new
HtmlArmor
(
'<script>alert("evil!");</script>'
),
37
'<script>alert("evil!");</script>'
,
38
],
39
[
40
new
HtmlArmor
(
null
),
41
null
,
42
]
43
];
44
}
45
49
public
function
testGetHtml
(
$input
, $expected ) {
50
$this->assertEquals(
51
$expected,
52
HtmlArmor::getHtml(
$input
)
53
);
54
}
55
}
HtmlArmorTest
HtmlArmor.
Definition
HtmlArmorTest.php:6
HtmlArmorTest\provideConstructor
static provideConstructor()
Definition
HtmlArmorTest.php:10
HtmlArmorTest\testGetHtml
testGetHtml( $input, $expected)
provideGetHtml
Definition
HtmlArmorTest.php:49
HtmlArmorTest\testConstructor
testConstructor( $value)
provideConstructor
Definition
HtmlArmorTest.php:21
HtmlArmorTest\provideGetHtml
static provideGetHtml()
Definition
HtmlArmorTest.php:25
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition
HtmlArmor.php:28
$input
if(is_array($mode)) switch( $mode) $input
Definition
postprocess-phan.php:145
$value
$value
Definition
styleTest.css.php:45
tests
phpunit
includes
libs
HtmlArmorTest.php
Generated on Mon Nov 25 2024 15:36:25 for MediaWiki by
1.10.0