From bb9e1c1aa906b3c6c2c19eb48c33b635dee6af20 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Wed, 27 Dec 2017 19:22:51 -0800 Subject: [PATCH 1/1] tests: Complete test coverage of HtmlArmor Change-Id: I3c50ea56721226ddb37bcf4778a7d71e9b56d0f7 --- tests/phpunit/includes/libs/HtmlArmorTest.php | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/includes/libs/HtmlArmorTest.php b/tests/phpunit/includes/libs/HtmlArmorTest.php index 5f176e0c85..0e9469ad04 100644 --- a/tests/phpunit/includes/libs/HtmlArmorTest.php +++ b/tests/phpunit/includes/libs/HtmlArmorTest.php @@ -5,7 +5,22 @@ */ class HtmlArmorTest extends PHPUnit_Framework_TestCase { - public static function provideHtmlArmor() { + public static function provideConstructor() { + return [ + [ 'test' ], + [ null ], + [ 'some html!' ] + ]; + } + + /** + * @dataProvider provideConstructor + */ + public function testConstructor( $value ) { + $this->assertInstanceOf( HtmlArmor::class, new HtmlArmor( $value ) ); + } + + public static function provideGetHtml() { return [ [ 'foobar', @@ -19,13 +34,17 @@ class HtmlArmorTest extends PHPUnit_Framework_TestCase { new HtmlArmor( '' ), '', ], + [ + new HtmlArmor( null ), + null, + ] ]; } /** - * @dataProvider provideHtmlArmor + * @dataProvider provideGetHtml */ - public function testHtmlArmor( $input, $expected ) { + public function testGetHtml( $input, $expected ) { $this->assertEquals( $expected, HtmlArmor::getHtml( $input ) -- 2.20.1