diff --git a/core/API/Proxy.php b/core/API/Proxy.php index f504bdeb8f608f92a3710f47b770c0c79c58b3be..bceac4556b7f5262adda56923b502276b061594a 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -28,6 +28,7 @@ use ReflectionMethod; * * @package Piwik * @subpackage Piwik_API + * @method \Piwik\API\Proxy getInstance() */ class Proxy extends Singleton { diff --git a/core/Config.php b/core/Config.php index c7a5ad9d272b354663841299d74dfbfb744de594..37213540d5941d4b0213f641d13b911e6161c839 100644 --- a/core/Config.php +++ b/core/Config.php @@ -41,6 +41,8 @@ use Exception; * * @package Piwik * @subpackage Piwik_Config + * @method \Piwik\Config getInstance() + * */ class Config extends Singleton { diff --git a/core/DataTable/Manager.php b/core/DataTable/Manager.php index 0ae03ede891d65190aaf27919779cab901a9a6ba..3613f70ee84deedad4b7920d5c6417ee2b6c96a6 100644 --- a/core/DataTable/Manager.php +++ b/core/DataTable/Manager.php @@ -23,6 +23,7 @@ use Piwik\Singleton; * * @package Piwik * @subpackage DataTable + * @method \Piwik\DataTable\Manager getInstance() */ class Manager extends Singleton { diff --git a/core/Db/Schema.php b/core/Db/Schema.php index 5ce1d55d622cb6f6412352c7405fa5f7a4838fdc..9fc6283c589aacfb17bc82c290821ef8d1eedc9c 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -20,6 +20,7 @@ use Piwik\Singleton; * * @package Piwik * @subpackage Piwik_Db + * @method \Piwik\Db\Schema getInstance() */ class Schema extends Singleton { diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php index c57cea990edcabf1de6d4210407e83514b997e51..642aaee3f70c0bdca667715220aa10b923d5eb6f 100644 --- a/core/EventDispatcher.php +++ b/core/EventDispatcher.php @@ -16,6 +16,8 @@ use Piwik\Plugin; /** * This class allows code to post events from anywhere in Piwik and for * plugins to associate callbacks to be executed when events are posted. + * + * @method \Piwik\EventDispatcher getInstance() */ class EventDispatcher extends Singleton { diff --git a/core/FrontController.php b/core/FrontController.php index 8b42c87a9850a04da3c77dbfd6352be963ef0e0a..3cf537c9f05f870b4f9b2ba8c37f14181a44ea8b 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -26,6 +26,7 @@ use Piwik\Session; * * @package Piwik * @subpackage FrontController + * @method \Piwik\FrontController getInstance() */ class FrontController extends Singleton { diff --git a/core/Log.php b/core/Log.php index 23017acd59404708b7b0c7891736446a13acc568..7a82135859f181d73a8c67d3592a90ef7e92e32d 100644 --- a/core/Log.php +++ b/core/Log.php @@ -25,6 +25,8 @@ use Piwik\Db; * * The logging utility can be configured by manipulating the INI config options in the * [log] section. + * + * @method \Piwik\Log getInstance() */ class Log extends Singleton { diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index b8f5b11e1ac8ba7f72103866890f8ff3cf6413e7..0c71a79ee319d3aa81c07a90d92371cae7d478ba 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -16,6 +16,7 @@ use Piwik\Singleton; /** * @package Piwik_Menu + * @method \Piwik\Menu\MenuAbstract getInstance() */ abstract class MenuAbstract extends Singleton { diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index fd461af5bbf63f47ae59941132acbe60263a115b..69020f478504a5b4f7eae296fb31a91631823bb2 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -25,6 +25,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php'; /** * Plugin manager * + * @method \Piwik\Plugin\Manager getInstance() * @package Piwik * @subpackage Manager */ @@ -67,6 +68,11 @@ class Manager extends Singleton 'TreemapVisualization', // should be moved to marketplace ); + public function getCorePluginsDisabledByDefault() + { + return $this->corePluginsDisabledByDefault; + } + // If a plugin hooks onto at least an event starting with "Tracker.", we load the plugin during tracker const TRACKER_EVENT_PREFIX = 'Tracker.'; @@ -399,15 +405,22 @@ class Manager extends Singleton $pluginsBundledWithPiwik = $pluginsBundledWithPiwik['Plugins']; return (!empty($pluginsBundledWithPiwik) - && in_array($name, $pluginsBundledWithPiwik)) - || in_array($name, $this->corePluginsDisabledByDefault); + && in_array($name, $pluginsBundledWithPiwik)) + || in_array($name, $this->getCorePluginsDisabledByDefault()); } protected function isPluginThirdPartyAndBogus($pluginName) { $path = $this->getPluginsDirectory() . $pluginName; + + $bogusPlugins = array( + 'PluginMarketplace' //defines a plugin.json but 1.x Piwik plugin + ); + $isBogus = !$this->isPluginBundledWithCore($pluginName) - && !$this->isManifestFileFound($path); + || !$this->isManifestFileFound($path) + || in_array($pluginName, $bogusPlugins); + return $isBogus; } @@ -423,6 +436,7 @@ class Manager extends Singleton if (is_null($pluginsToLoad)) { $pluginsToLoad = array(); } + $pluginsToLoad = array_unique($pluginsToLoad); $this->pluginsToLoad = $pluginsToLoad; $this->reloadPlugins(); } @@ -462,8 +476,6 @@ class Manager extends Singleton /** * Execute postLoad() hook for loaded plugins - * - * @see Piwik_Plugin::postLoad() */ public function postLoadPlugins() { diff --git a/core/Registry.php b/core/Registry.php index 88ecc1ce95780c8fb8e9be8d5d7484b0105dda06..12ed1d963cd178b68cf7a8524b4cb399c57bbf15 100644 --- a/core/Registry.php +++ b/core/Registry.php @@ -14,6 +14,7 @@ namespace Piwik; * Registry class. * * @package Piwik + * @method \Piwik\Registry getInstance() */ class Registry extends Singleton { diff --git a/plugins/CoreConsole/RunTests.php b/plugins/CoreConsole/RunTests.php index 4176ab1dcc90e03df0d57ed31e4d7e1bc13d3c75..7250993e8dfe114cf288ee22848a9665f0b87e7f 100644 --- a/plugins/CoreConsole/RunTests.php +++ b/plugins/CoreConsole/RunTests.php @@ -22,10 +22,15 @@ use Symfony\Component\Console\Output\OutputInterface; */ class RunTests extends Command { + protected function getTestsGroups() + { + return array('Core', 'Plugins', 'Integration'); + } + protected function configure() { $this->setName('tests:run'); - $this->setDescription('Run Piwik PHPUnit tests'); + $this->setDescription('Run Piwik PHPUnit tests one group after the other'); $this->addArgument('group', InputArgument::OPTIONAL, 'Run only a specific test group. Separate multiple groups by comma, for instance core,integration', ''); $this->addOption('options', 'o', InputOption::VALUE_OPTIONAL, 'All options will be forwarded to phpunit', ''); } @@ -33,17 +38,23 @@ class RunTests extends Command protected function execute(InputInterface $input, OutputInterface $output) { $options = $input->getOption('options'); - $group = $input->getArgument('group'); + $groups = $input->getArgument('group'); + $groups = explode(",", $groups); + $groups = array_map('ucfirst', $groups); + $groups = array_filter('strlen', $groups); + if(empty($groups)) { + $groups = $this->getTestsGroups(); - if (!empty($group)) { - $groups = explode(',', $group); - $groups = array_map('ucfirst', $groups); - $options = '--group ' . implode(',', $groups) . ' ' . $options; + if(\UITest::isPhantomJsAvailable()) { + $groups[] = 'UI'; + } + } + foreach($groups as $group) { + $params = '--group ' . $group . ' ' . $options; + $cmd = sprintf('cd %s/tests/PHPUnit && phpunit %s', PIWIK_DOCUMENT_ROOT, $params); + $output->writeln('Executing command: ' . $cmd); + passthru($cmd); + $output->writeln(); } - - $cmd = sprintf('cd %s/tests/PHPUnit && phpunit %s', PIWIK_DOCUMENT_ROOT, $options); - - $output->writeln('Executing command: ' . $cmd); - passthru($cmd); } } \ No newline at end of file diff --git a/plugins/ExamplePlugin/config/local.config.php b/plugins/ExamplePlugin/config/local.config.php deleted file mode 100644 index cf846146e4155dcf27b643e3fe8c9d1a2f49e410..0000000000000000000000000000000000000000 --- a/plugins/ExamplePlugin/config/local.config.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -return array ( - 0 => 1, - 1 => 'mixed', - 2 => - array ( - 0 => 'a', - ), - 'b' => 'c', -); diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 738778956840ce2e0f19a0f8eb501e9fc1f2f406..612d6de6f1d231c52623f11649db3e520c40e4e9 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -42,6 +42,7 @@ use Piwik\UrlHelper; * The existing values can be fetched via "getExcludedIpsGlobal" and "getExcludedQueryParametersGlobal". * See also the documentation about <a href='http://piwik.org/docs/manage-websites/' target='_blank'>Managing Websites</a> in Piwik. * @package SitesManager + * @method \Piwik\Plugins\SitesManager\API getInstance() */ class API extends \Piwik\Plugin\API { diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index 1fd94f98dd0f07cb8a326d0f2d458f5be884e403..c295c48a3dabdfee28657fe7f784bd5c80d86c06 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -17,7 +17,6 @@ use Piwik\Version; use Piwik\WidgetsList; /** - * * @package UserCountryMap */ class UserCountryMap extends \Piwik\Plugin @@ -50,9 +49,6 @@ class UserCountryMap extends \Piwik\Plugin $out .= FrontController::getInstance()->fetchDispatch('UserCountryMap', 'visitorMap'); } - /** - * @see Piwik_Plugin::getListHooksRegistered - */ public function getListHooksRegistered() { $hooks = array( diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index ae83c70bfc5864110820df10300a3240acf77ddf..867ee1e8342b337d946f9d355ffbb422c1f3a4a1 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -101,9 +101,12 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase public static function loadAllPlugins() { $pluginsManager = \Piwik\Plugin\Manager::getInstance(); - $pluginsToLoad = Config::getInstance()->Plugins['Plugins']; - $pluginsToLoad[] = 'DevicesDetection'; - + + $pluginsToLoad = array_merge( + $pluginsManager->readPluginsDirectory(), + $pluginsManager->getCorePluginsDisabledByDefault(), + Config::getInstance()->Plugins['Plugins'] + ); $pluginsManager->loadPlugins($pluginsToLoad); } diff --git a/tests/PHPUnit/UITest.php b/tests/PHPUnit/UITest.php index 87eee4114f8eff61c3bf372537f29c19e007a7af..e073711a55e284692af4790a8222227a1f0d349d 100644 --- a/tests/PHPUnit/UITest.php +++ b/tests/PHPUnit/UITest.php @@ -218,7 +218,7 @@ Screenshot diff: $diffPath\n"; return self::isProgramAvailable('slimerjs'); } - private static function isPhantomJsAvailable() + public static function isPhantomJsAvailable() { return self::isProgramAvailable('phantomjs'); } diff --git a/tests/README.md b/tests/README.md index 25c26207e047b33ee4b864c63c1f8ca759a971ab..cc68fd804fd01f2442a36dc376bc4f8b718f8fc9 100644 --- a/tests/README.md +++ b/tests/README.md @@ -154,16 +154,10 @@ You can import data over several days in Piwik: 5. You can then archive the reports with: - $ php5 /home/piwik/misc/cron/archive.php --url=http://localhost/path/ + $ php5 /home/piwik/misc/cron/archive.php --url=http://localhost/path/ You should now have some interesting data to test with in November 2012! -## Selenium Webdriver tests - -We would like to add Webdriver selenium testing for the following: installation, auto update from 1.0, initial user login. - -Task is tracked in: http://dev.piwik.org/trac/ticket/2935 - ## Scheduled Reports Tests Piwik scheduled reports (HTML, PDF & SMS) are part of the integration test suite.