From: Kunal Mehta Date: Thu, 28 Dec 2017 03:22:51 +0000 (-0800) Subject: tests: Complete test coverage of HtmlArmor X-Git-Tag: 1.31.0-rc.0~1065^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=bb9e1c1aa906b3c6c2c19eb48c33b635dee6af20;hp=a166e509431ab2f002e3ae68ac3b01a4261a9b16 tests: Complete test coverage of HtmlArmor Change-Id: I3c50ea56721226ddb37bcf4778a7d71e9b56d0f7 --- 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 )