Reedy has submitted this change and it was merged.
Change subject: Added MenuTest
......................................................................
Added MenuTest
Change-Id: Ib6e89f1a60e71220320578b8b82fff75dec87035
---
M EducationProgram.hooks.php
A tests/phpunit/MenuTest.php
2 files changed, 53 insertions(+), 0 deletions(-)
Approvals:
Reedy: Verified; Looks good to me, approved
diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php
index 031b8fc..312d14d 100644
--- a/EducationProgram.hooks.php
+++ b/EducationProgram.hooks.php
@@ -65,6 +65,7 @@
public static function registerUnitTests( array &$files ) {
$testFiles = array(
'Actions',
+ 'Menu',
'Specials',
'Utils',
diff --git a/tests/phpunit/MenuTest.php b/tests/phpunit/MenuTest.php
new file mode 100644
index 0000000..43a6915
--- /dev/null
+++ b/tests/phpunit/MenuTest.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace EducationProgram\Test;
+use EducationProgram\Menu;
+
+/**
+ * Tests for the EducationProgram\Menu class.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @since 0.4
+ *
+ * @ingroup EducationProgramTest
+ *
+ * @group EducationProgram
+ *
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+class MenuTest extends \MediaWikiTestCase {
+
+ public function testConstructor() {
+ $menu = new Menu( \RequestContext::getMain() );
+
+ $this->assertInternalType( 'string', $menu->getHTML() );
+ }
+
+ public function testSetItemFunction() {
+ $menu = new Menu( \RequestContext::getMain() );
+
+ $menu->setItemFunction( function( array $items ) {
+ unset( $items['ep-nav-mycourses'] );
+ return $items;
+ } );
+
+ $this->assertInternalType( 'string', $menu->getHTML() );
+ }
+
+}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/45959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6e89f1a60e71220320578b8b82fff75dec87035
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Ragesoss <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits