*/
class HtmlArmorTest extends PHPUnit_Framework_TestCase {
- public static function provideHtmlArmor() {
+ 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',
new HtmlArmor( '<script>alert("evil!");</script>' ),
'<script>alert("evil!");</script>',
],
+ [
+ new HtmlArmor( null ),
+ null,
+ ]
];
}
/**
- * @dataProvider provideHtmlArmor
+ * @dataProvider provideGetHtml
*/
- public function testHtmlArmor( $input, $expected ) {
+ public function testGetHtml( $input, $expected ) {
$this->assertEquals(
$expected,
HtmlArmor::getHtml( $input )