Yurik has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/197442

Change subject: Automatically run all phpunit tests
......................................................................

Automatically run all phpunit tests

Change-Id: I82f20f8fe66ced15e671a64dcdd4c8ea5dab7f53
---
M Gather.php
M extension.json
M includes/Gather.hooks.php
A tests/phpunit/Testing.hooks.php
4 files changed, 34 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/42/197442/1

diff --git a/Gather.php b/Gather.php
index 50556d2..cbe9bb9 100644
--- a/Gather.php
+++ b/Gather.php
@@ -33,6 +33,7 @@
 $autoloadClasses = array(
        'Gather\Hooks' => 'Gather.hooks',
        'Gather\UpdaterHooks' => '../schema/Updater.hooks',
+       'Gather\TestingHooks' => '../tests/Testing.hooks',
 
        'Gather\models\CollectionItem' => 'models/CollectionItem',
        'Gather\models\CollectionBase' => 'models/CollectionBase',
@@ -71,13 +72,13 @@
 // Hooks
 $wgExtensionFunctions[] = 'Gather\Hooks::onExtensionSetup';
 $wgHooks['MobilePersonalTools'][] = 'Gather\Hooks::onMobilePersonalTools';
-$wgHooks['UnitTestsList'][] = 'Gather\Hooks::onUnitTestsList';
 $wgHooks['SkinMinervaDefaultModules'][] = 
'Gather\Hooks::onSkinMinervaDefaultModules';
 $wgHooks['MakeGlobalVariablesScript'][] = 
'Gather\Hooks::onMakeGlobalVariablesScript';
 $wgHooks['ResourceLoaderTestModules'][] = 
'Gather\Hooks::onResourceLoaderTestModules';
 
 // Maintenance Hooks
 $wgHooks['LoadExtensionSchemaUpdates'][] = 
'Gather\UpdaterHooks::onLoadExtensionSchemaUpdates';
+$wgHooks['UnitTestsList'][] = 'Gather\TestingHooks::onUnitTestsList';
 
 // Api
 $wgAPIModules['editlist'] = 'Gather\api\ApiEditList';
diff --git a/extension.json b/extension.json
index 50534a5..7d3780b 100644
--- a/extension.json
+++ b/extension.json
@@ -26,6 +26,7 @@
        "AutoloadClasses": {
                "Gather\\Hooks": "includes/Gather.hooks.php",
                "Gather\\UpdaterHooks": "schema/Updater.hooks.php",
+               "Gather\\TestingHooks": "tests/Testing.hooks.php",
                "Gather\\models\\CollectionItem": 
"includes/models/CollectionItem.php",
                "Gather\\models\\CollectionBase": 
"includes/models/CollectionBase.php",
                "Gather\\models\\CollectionInfo": 
"includes/models/CollectionInfo.php",
@@ -249,6 +250,9 @@
                ],
                "LoadExtensionSchemaUpdates": [
                        "Gather\\UpdaterHooks::onLoadExtensionSchemaUpdates"
+               ],
+               "UnitTestsList": [
+                       "Gather\\TestingHooks::onUnitTestsList"
                ]
        }
 }
diff --git a/includes/Gather.hooks.php b/includes/Gather.hooks.php
index 4af89e9..b19bda5 100644
--- a/includes/Gather.hooks.php
+++ b/includes/Gather.hooks.php
@@ -67,19 +67,6 @@
        }
 
        /**
-        * UnitTestsList hook handler
-        * @see https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList
-        *
-        * @param array $files
-        * @return bool
-        */
-       public static function onUnitTestsList( &$files ) {
-               $files[] = __DIR__ . '/../tests/phpunit';
-
-               return true;
-       }
-
-       /**
         * Register QUnit tests.
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
         *
diff --git a/tests/phpunit/Testing.hooks.php b/tests/phpunit/Testing.hooks.php
new file mode 100644
index 0000000..45e0512
--- /dev/null
+++ b/tests/phpunit/Testing.hooks.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Gather;
+
+use \SpecialPage;
+use Gather\models;
+use Gather\views\helpers\CSS;
+use \MobileContext;
+
+/**
+ * Test Hook handlers for Gather extension
+ */
+class TestingHooks {
+       /**
+        * UnitTestsList hook handler
+        * @see https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList
+        *
+        * @param array $files
+        * @return bool
+        */
+       public static function onUnitTestsList( &$files ) {
+               $files = array_merge( $files,
+                       glob( __DIR__ . '/api/*.php' ),
+                       glob( __DIR__ . '/models/*.php' )
+               );
+               return true;
+       }
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82f20f8fe66ced15e671a64dcdd4c8ea5dab7f53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>

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

Reply via email to