Ljonka has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350805 )

Change subject: SmartList: Add phpunit base tests
......................................................................

SmartList: Add phpunit base tests

Change-Id: I9d193e51aeded03e7f692720acac78de23b33027
---
M SmartList/SmartList.class.php
M SmartList/extension.json
A SmartList/tests/phpunit/BSApiTasksSmartListTest.php
3 files changed, 83 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/05/350805/1

diff --git a/SmartList/SmartList.class.php b/SmartList/SmartList.class.php
index 8021dc6..53cb533 100644
--- a/SmartList/SmartList.class.php
+++ b/SmartList/SmartList.class.php
@@ -1416,4 +1416,16 @@
                );
                return true;
        }
+
+       /**
+        * UnitTestsList allows registration of additional test suites to 
execute
+        * under PHPUnit. Extensions can append paths to files to the $paths 
array,
+        * and since MediaWiki 1.24, can specify paths to directories, which 
will
+        * be scanned recursively for any test case files with the suffix 
"Test.php".
+        * @param array $paths
+        */
+       public static function onUnitTestsList( array &$paths ) {
+               $paths[] = __DIR__ . '/tests/phpunit/';
+               return true;
+       }
 }
diff --git a/SmartList/extension.json b/SmartList/extension.json
index ef0ed99..eb9b855 100644
--- a/SmartList/extension.json
+++ b/SmartList/extension.json
@@ -30,5 +30,8 @@
                "SmartList": "SmartList.class.php",
                "BSApiTasksSmartList": "includes/api/BSApiTasksSmartList.php"
        },
+       "Hooks":{
+               "UnitTestsList": "SmartList::onUnitTestsList"
+       },
        "manifest_version": 1
 }
diff --git a/SmartList/tests/phpunit/BSApiTasksSmartListTest.php 
b/SmartList/tests/phpunit/BSApiTasksSmartListTest.php
new file mode 100644
index 0000000..b2d7c02
--- /dev/null
+++ b/SmartList/tests/phpunit/BSApiTasksSmartListTest.php
@@ -0,0 +1,68 @@
+<?php
+
+/*
+ * Test BlueSpice SmartList API Endpoints
+ */
+
+/**
+ * @group BlueSpiceSmartList
+ * @group BlueSpice
+ * @group API
+ * @group Database
+ * @group medium
+ */
+class BSApiTasksSmartListTest extends BSApiTasksTestBase {
+
+       protected function getModuleName() {
+               return "bs-smartlist-tasks";
+       }
+
+       function testGetMostActivePortlet() {
+               $data = $this->executeTask(
+                 'getMostActivePortlet', [
+                       'portletConfig' => [ json_encode( [ ] ) ]
+                 ]
+               );
+
+               $this->assertEquals( true, $data->success );
+
+               return $data;
+       }
+
+       function testGetMostEditedPages() {
+               $data = $this->executeTask(
+                 'getMostEditedPages', [
+                       'portletConfig' => [ json_encode( [ ] ) ]
+                 ]
+               );
+
+               $this->assertEquals( true, $data->success );
+
+               return $data;
+       }
+
+       function testGetMostVisitedPages() {
+               $data = $this->executeTask(
+                 'getMostVisitedPages', [
+                       'portletConfig' => [ json_encode( [ ] ) ]
+                 ]
+               );
+
+               $this->assertEquals( true, $data->success );
+
+               return $data;
+       }
+
+       function testGetYourEditsPortlet() {
+               $data = $this->executeTask(
+                 'getYourEditsPortlet', [
+                       'portletConfig' => [ json_encode( [ ] ) ]
+                 ]
+               );
+
+               $this->assertEquals( true, $data->success );
+
+               return $data;
+       }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d193e51aeded03e7f692720acac78de23b33027
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Ljonka <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to