Reedy has submitted this change and it was merged.

Change subject: Added TimelineTest
......................................................................


Added TimelineTest

Change-Id: I08677068b3567524f5305b0a33d4c90ae231479f
---
M EducationProgram.hooks.php
M includes/Timeline.php
M includes/TimelineGroup.php
A tests/phpunit/TimelineTest.php
4 files changed, 63 insertions(+), 4 deletions(-)

Approvals:
  Reedy: Verified; Looks good to me, approved



diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php
index 031b8fc..b5485f5 100644
--- a/EducationProgram.hooks.php
+++ b/EducationProgram.hooks.php
@@ -66,6 +66,7 @@
                $testFiles = array(
                        'Actions',
                        'Specials',
+                       'Timeline',
                        'Utils',
 
                        'rows/Article',
diff --git a/includes/Timeline.php b/includes/Timeline.php
index d214567..30c8150 100644
--- a/includes/Timeline.php
+++ b/includes/Timeline.php
@@ -29,9 +29,9 @@
         * @since 0.1
         *
         * @param IContextSource $context
-        * @param array $events
+        * @param Event[] $events
         */
-       public function __construct( IContextSource $context, array /* of Event 
*/ $events ) {
+       public function __construct( IContextSource $context, array $events ) {
                $this->setContext( $context );
                $this->events = $events;
        }
diff --git a/includes/TimelineGroup.php b/includes/TimelineGroup.php
index 93b4773..49abb8d 100644
--- a/includes/TimelineGroup.php
+++ b/includes/TimelineGroup.php
@@ -6,6 +6,8 @@
 /**
  * Class for displaying a group of Education Program events in a timeline.
  *
+ * FIXME: these classes are abusing inheritance.
+ *
  * @since 0.1
  *
  * @ingroup EducationProgram
@@ -70,10 +72,10 @@
         *
         * @since 0.1
         *
-        * @param array $events
+        * @param Event[] $events
         * @param IContextSource|null $context
         */
-       protected function __construct( array /* of Event */ $events, 
IContextSource $context = null ) {
+       protected function __construct( array $events, IContextSource $context 
= null ) {
                if ( !is_null( $context ) ) {
                        $this->setContext( $context );
                }
diff --git a/tests/phpunit/TimelineTest.php b/tests/phpunit/TimelineTest.php
new file mode 100644
index 0000000..129189a
--- /dev/null
+++ b/tests/phpunit/TimelineTest.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace EducationProgram\Test;
+use EducationProgram\Timeline;
+
+/**
+ * Tests for the EducationProgram\Timeline 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
+ *
+ * @file
+ * @since 0.4
+ *
+ * @ingroup EducationProgramTest
+ *
+ * @group EducationProgram
+ *
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+class TimelineTest extends \MediaWikiTestCase {
+
+       public function constructorProvider() {
+               $argLists = array();
+
+               $argLists[] = array( \RequestContext::getMain(), array() );
+
+               return $argLists;
+       }
+
+       /**
+        * @dataProvider constructorProvider
+        *
+        * @param \IContextSource $context
+        * @param array $events
+        */
+       public function testConstructor( \IContextSource $context, array 
$events ) {
+               $timeline = new Timeline( $context, $events );
+
+               $this->assertInternalType( 'string', $timeline->getHTML() );
+       }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/45958
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08677068b3567524f5305b0a33d4c90ae231479f
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

Reply via email to