From 379407a640f68c9abf10e1da88c8687826d45be0 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sun, 19 Aug 2018 21:46:21 -0700 Subject: [PATCH] Support a heading of '0' in Html::messageBox() Change-Id: I181cb6f92ab1b10d87b1213a043a5f291149d094 --- includes/Html.php | 2 +- tests/phpunit/includes/HtmlTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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
' + ); } /** -- 2.20.1