From: Kunal Mehta Date: Mon, 20 Aug 2018 04:46:21 +0000 (-0700) Subject: Support a heading of '0' in Html::messageBox() X-Git-Tag: 1.34.0-rc.0~4369 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=379407a640f68c9abf10e1da88c8687826d45be0;p=lhc%2Fweb%2Fwiklou.git Support a heading of '0' in Html::messageBox() Change-Id: I181cb6f92ab1b10d87b1213a043a5f291149d094 --- diff --git a/includes/Html.php b/includes/Html.php index 32375c1f57..dba4c67a72 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -704,7 +704,7 @@ class Html { * @return string of HTML representing a box. */ private static function messageBox( $html, $className, $heading = '' ) { - if ( $heading ) { + if ( $heading !== '' ) { $html = self::element( 'h2', [], $heading ) . $html; } return self::rawElement( 'div', [ 'class' => $className ], $html ); diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index dc32a6fff3..070a02936f 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -476,6 +476,10 @@ class HtmlTest extends MediaWikiTestCase { Html::errorBox( 'err', 'heading' ), '

heading

err
' ); + $this->assertEquals( + Html::errorBox( 'err', '0' ), + '

0

err
' + ); } /**