Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4097662
HtmlArmorTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HtmlArmorTest.php
View Options
<?php
namespace
Wikimedia\Tests
;
use
HtmlArmor
;
use
MediaWikiCoversValidator
;
use
PHPUnit\Framework\TestCase
;
/**
* @covers \HtmlArmor
*/
class
HtmlArmorTest
extends
TestCase
{
use
MediaWikiCoversValidator
;
public
static
function
provideConstructor
()
{
return
[
[
'test'
],
[
null
],
[
'<em>some html!</em>'
]
];
}
/**
* @dataProvider provideConstructor
*/
public
function
testConstructor
(
$value
)
{
$this
->
assertInstanceOf
(
HtmlArmor
::
class
,
new
HtmlArmor
(
$value
)
);
}
public
static
function
provideGetHtml
()
{
return
[
[
'foobar'
,
'foobar'
,
],
[
'<script>alert("evil!");</script>'
,
'<script>alert("evil!");</script>'
,
],
[
new
HtmlArmor
(
'<script>alert("evil!");</script>'
),
'<script>alert("evil!");</script>'
,
],
[
new
HtmlArmor
(
null
),
null
,
]
];
}
/**
* @dataProvider provideGetHtml
*/
public
function
testGetHtml
(
$input
,
$expected
)
{
$this
->
assertEquals
(
$expected
,
HtmlArmor
::
getHtml
(
$input
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 14:59 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
14/db/795e6941f7a5101a256c10b97b98
Default Alt Text
HtmlArmorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment