Jdlrobson has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/391626 )
Change subject: Add unit tests for Html helper methods and change messageBox
visibility
......................................................................
Add unit tests for Html helper methods and change messageBox visibility
* Messagebox is now private to Html class to discourage unconventional
usages
* Tests are added for all three helper methods added in
4e7021a2318ec588e4d0b226c64d25e93ec80bd8
Bug: T166915
Change-Id: I1c3e4131b2439c0f4fb94ad4e616a909b52d6b78
---
M includes/Html.php
M tests/phpunit/includes/HtmlTest.php
2 files changed, 35 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/26/391626/1
diff --git a/includes/Html.php b/includes/Html.php
index 524fdcd..dfd80a8 100644
--- a/includes/Html.php
+++ b/includes/Html.php
@@ -683,7 +683,7 @@
* @param string $heading (optional)
* @return string of HTML representing a box.
*/
- public static function messageBox( $html, $className, $heading = '' ) {
+ private static function messageBox( $html, $className, $heading = '' ) {
if ( $heading ) {
$html = self::element( 'h2', [], $heading ) . $html;
}
diff --git a/tests/phpunit/includes/HtmlTest.php
b/tests/phpunit/includes/HtmlTest.php
index f3d4916..5188add 100644
--- a/tests/phpunit/includes/HtmlTest.php
+++ b/tests/phpunit/includes/HtmlTest.php
@@ -448,6 +448,40 @@
}
/**
+ * @covers Html::warningBox
+ */
+ public function testWarningBox() {
+ $this->assertEquals(
+ Html::warningBox( 'warn' ),
+ '<div class="warningbox">warn</div>'
+ );
+ }
+
+ /**
+ * @covers Html::errorBox
+ */
+ public function testErrorBox() {
+ $this->assertEquals(
+ Html::errorBox( 'err' ),
+ '<div class="errorbox">err</div>'
+ );
+ $this->assertEquals(
+ Html::errorBox( 'err', 'heading' ),
+ '<div class="errorbox"><h2>heading</h2>err</div>'
+ );
+ }
+
+ /**
+ * @covers Html::errorBox
+ */
+ public function testSuccessBox() {
+ $this->assertEquals(
+ Html::successBox( 'great' ),
+ '<div class="successbox">great</div>'
+ );
+ }
+
+ /**
* List of input element types values introduced by HTML5
* Full list at https://www.w3.org/TR/html-markup/input.html
*/
--
To view, visit https://gerrit.wikimedia.org/r/391626
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c3e4131b2439c0f4fb94ad4e616a909b52d6b78
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits