From 9742718f792c952961303c8db9768763b4ce6e6a Mon Sep 17 00:00:00 2001 From: mattab Date: Fri, 21 Feb 2014 11:59:40 +1300 Subject: [PATCH] Revert change to not hardcode any plugin list (as nobody would remember to update those when we add plugins) --- core/Plugin/Manager.php | 65 +++++---------------------- tests/PHPUnit/IntegrationTestCase.php | 2 +- tests/PHPUnit/TestingEnvironment.php | 2 +- 3 files changed, 13 insertions(+), 56 deletions(-) diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 6be38939dd2..1a53da63655 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -72,60 +72,17 @@ class Manager extends Singleton 'LeftMenu' ); - public static $pluginsToLoadForTests = array( - "CorePluginsAdmin", - "CoreAdminHome", - "CoreHome", - "Proxy", - "API", - "Widgetize", - "Transitions", - "LanguagesManager", - "Actions", - "Dashboard", - "MultiSites", - "Referrers", - "UserSettings", - "Goals", - "SEO", - "UserCountry", - "VisitsSummary", - "VisitFrequency", - "VisitTime", - "VisitorInterest", - "ExampleAPI", - "ExamplePlugin", - "ExampleRssWidget", - "Provider", - "Feedback", - "Login", - "UsersManager", - "SitesManager", - "Installation", - "CoreUpdater", - "ScheduledReports", - "UserCountryMap", - "Live", - "CustomVariables", - "PrivacyManager", - "ImageGraph", - "Annotations", - "MobileMessaging", - "Overlay", - "SegmentEditor", - "DevicesDetection", - "DBStats", - 'ExampleUI', - "TasksTimetable", - "Morpheus", - "Zeitgeist", - "CustomAlerts", - "VisitorGenerator", - "SecurityInfo", - "ExampleSettingsPlugin", - "TreemapVisualization", - "Events" - ); + public static function getPluginsToLoadDuringTests() + { + $manager = \Piwik\Plugin\Manager::getInstance(); + $toLoad = array(); + foreach($manager->readPluginsDirectory() as $plugin) { + if($manager->isPluginBundledWithCore($plugin)) { + $toLoad[] = $plugin; + } + } + return $toLoad; + } public function getCorePluginsDisabledByDefault() { diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index b7a5829fff5..42a0a3656f1 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -238,7 +238,7 @@ public static function _tearDownAfterClass($dropDatabase = true) protected static function getPluginsToLoadDuringTests() { - return \Piwik\Plugin\Manager::$pluginsToLoadForTests; + return \Piwik\Plugin\Manager::getInstance()->getPluginsToLoadDuringTests(); } public function setUp() diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php index 3bd0ad9d91d..27b11693a48 100644 --- a/tests/PHPUnit/TestingEnvironment.php +++ b/tests/PHPUnit/TestingEnvironment.php @@ -46,7 +46,7 @@ public static function addHooks() $config->setTestEnvironment(); - $pluginsToLoad = \Piwik\Plugin\Manager::$pluginsToLoadForTests; + $pluginsToLoad = \Piwik\Plugin\Manager::getInstance()->getPluginsToLoadDuringTests(); $config->Plugins = array('Plugins' => $pluginsToLoad); $trackerPluginsToLoad = array(