Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-11-03 05:29:06 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-11-03 05:29:06 +0300
commitafe288d64d60095cd35e22dadeec70c1a5010eda (patch)
treef271858ac35a08cb64c189b185f36a297e583557
parentbe9d076fa409dba59ba1621c1445a5ef55a90943 (diff)
parent7b443febee6f9a00d8f3b730c24393bfb261f3d7 (diff)
Merge branch 'master' into php-di
-rw-r--r--LEGALNOTICE8
-rw-r--r--composer.lock82
-rw-r--r--core/Exceptions/HtmlMessageException.php12
-rw-r--r--core/Exceptions/HtmlMessageExceptionInterface.php20
-rw-r--r--core/FrontController.php5
-rw-r--r--core/Plugin/Manager.php8
-rw-r--r--core/Url.php3
-rw-r--r--plugins/Actions/Actions.php4
-rw-r--r--plugins/Actions/Menu.php6
-rw-r--r--plugins/Actions/Reports/GetSiteSearchCategories.php4
-rw-r--r--plugins/Actions/Reports/SiteSearchBase.php26
-rw-r--r--plugins/CorePluginsAdmin/Controller.php4
-rw-r--r--plugins/CorePluginsAdmin/Marketplace.php2
-rwxr-xr-xplugins/Installation/templates/_systemCheckSection.twig2
-rw-r--r--plugins/TestRunner/Aws/Instance.php18
-rw-r--r--plugins/TestRunner/Runner/Remote.php2
-rw-r--r--tests/PHPUnit/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt4
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_csv__ScheduledReports.generateReport_month.original.csv15
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html50
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv15
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html50
-rw-r--r--tests/PHPUnit/Unit/API/ApiRendererTest.php17
-rw-r--r--tests/PHPUnit/Unit/API/ResponseBuilderTest.php8
-rw-r--r--tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php2
-rw-r--r--tests/PHPUnit/Unit/AssetManager/PluginMock.php2
-rw-r--r--tests/PHPUnit/Unit/AssetManager/ThemeMock.php2
-rw-r--r--tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php2
-rw-r--r--tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterTest.php4
-rw-r--r--tests/PHPUnit/Unit/AssetManager/UIAssetCatalogSorterTest.php4
-rw-r--r--tests/PHPUnit/Unit/AssetManagerTest.php17
-rw-r--r--tests/PHPUnit/Unit/CliMulti/OutputTest.php10
-rw-r--r--tests/PHPUnit/Unit/CliMulti/ProcessTest.php6
-rw-r--r--tests/PHPUnit/Unit/Columns/DimensionTest.php2
-rw-r--r--tests/PHPUnit/Unit/CommonTest.php16
-rw-r--r--tests/PHPUnit/Unit/ConfigTest.php3
-rw-r--r--tests/PHPUnit/Unit/CookieTest.php12
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/SortTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/MapTest.php7
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTable/RowTest.php5
-rw-r--r--tests/PHPUnit/Unit/DataTableTest.php8
-rw-r--r--tests/PHPUnit/Unit/DateTest.php6
-rw-r--r--tests/PHPUnit/Unit/DependencyTest.php17
-rw-r--r--tests/PHPUnit/Unit/DeprecatedMethodsTest.php25
-rw-r--r--tests/PHPUnit/Unit/FactoryTest.php13
-rw-r--r--tests/PHPUnit/Unit/FilesystemTest.php5
-rw-r--r--tests/PHPUnit/Unit/IPTest.php4
-rw-r--r--tests/PHPUnit/Unit/Menu/MenuReportingTest.php6
-rw-r--r--tests/PHPUnit/Unit/MetricsTest.php15
-rw-r--r--tests/PHPUnit/Unit/NonceTest.php16
-rw-r--r--tests/PHPUnit/Unit/Period/DayTest.php12
-rw-r--r--tests/PHPUnit/Unit/Period/MonthTest.php8
-rw-r--r--tests/PHPUnit/Unit/Period/RangeTest.php9
-rw-r--r--tests/PHPUnit/Unit/Period/WeekTest.php8
-rw-r--r--tests/PHPUnit/Unit/Period/YearTest.php8
-rw-r--r--tests/PHPUnit/Unit/PeriodTest.php7
-rw-r--r--tests/PHPUnit/Unit/RankingQueryTest.php6
-rw-r--r--tests/PHPUnit/Unit/RegistryTest.php5
-rw-r--r--tests/PHPUnit/Unit/ScheduledTaskTest.php10
-rw-r--r--tests/PHPUnit/Unit/ScheduledTime/DailyTest.php12
-rw-r--r--tests/PHPUnit/Unit/ScheduledTime/HourlyTest.php6
-rw-r--r--tests/PHPUnit/Unit/ScheduledTime/MonthlyTest.php5
-rw-r--r--tests/PHPUnit/Unit/ScheduledTime/WeeklyTest.php6
-rw-r--r--tests/PHPUnit/Unit/SegmentExpressionTest.php7
-rw-r--r--tests/PHPUnit/Unit/TaskSchedulerTest.php39
-rw-r--r--tests/PHPUnit/Unit/Translate/Filter/ByBaseTranslationsTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Filter/ByParameterCountTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Filter/EmptyTranslationsTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Filter/EncodedEntitiesTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Filter/UnnecassaryWhitespacesTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Validate/CoreTranslationsTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/Validate/NoScriptsTest.php9
-rw-r--r--tests/PHPUnit/Unit/Translate/WriterTest.php24
-rw-r--r--tests/PHPUnit/Unit/TranslateTest.php10
-rw-r--r--tests/PHPUnit/Unit/UrlHelperTest.php14
-rw-r--r--tests/PHPUnit/Unit/UrlTest.php16
-rw-r--r--tests/lib/screenshot-testing/support/chai-extras.js2
88 files changed, 628 insertions, 288 deletions
diff --git a/LEGALNOTICE b/LEGALNOTICE
index 9d40d32ee6..c438523071 100644
--- a/LEGALNOTICE
+++ b/LEGALNOTICE
@@ -73,6 +73,14 @@ SEPARATELY LICENSED COMPONENTS AND LIBRARIES
Link: https://github.com/piwik/piwik/blob/master/libs/UserAgentParser/
License: New BSD
+ Name: Piwik/Decompress
+ Link: https://github.com/piwik/component-decompress
+ License: LGPL v3.0
+
+ Name: Piwik/Network
+ Link: https://github.com/piwik/component-network
+ License: LGPL v3.0
+
THIRD-PARTY COMPONENTS AND LIBRARIES
diff --git a/composer.lock b/composer.lock
index d983793074..3221f0ad25 100644
--- a/composer.lock
+++ b/composer.lock
@@ -471,16 +471,16 @@
},
{
"name": "piwik/device-detector",
- "version": "2.5.1",
+ "version": "2.6",
"source": {
"type": "git",
"url": "https://github.com/piwik/device-detector.git",
- "reference": "a15c326733bf596e23c19b319c15c8780be9fe34"
+ "reference": "60831e80b45d296e19b07cde198fe8dff7311bec"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/piwik/device-detector/zipball/a15c326733bf596e23c19b319c15c8780be9fe34",
- "reference": "a15c326733bf596e23c19b319c15c8780be9fe34",
+ "url": "https://api.github.com/repos/piwik/device-detector/zipball/60831e80b45d296e19b07cde198fe8dff7311bec",
+ "reference": "60831e80b45d296e19b07cde198fe8dff7311bec",
"shasum": ""
},
"require": {
@@ -514,7 +514,7 @@
"parser",
"useragent"
],
- "time": "2014-10-06 20:13:03"
+ "time": "2014-10-30 13:45:01"
},
{
"name": "piwik/network",
@@ -550,17 +550,17 @@
},
{
"name": "symfony/console",
- "version": "v2.5.5",
+ "version": "v2.5.6",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
- "reference": "ca053eaa031c93afb68a71e4eb1f4168dfd4a661"
+ "reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Console/zipball/ca053eaa031c93afb68a71e4eb1f4168dfd4a661",
- "reference": "ca053eaa031c93afb68a71e4eb1f4168dfd4a661",
+ "url": "https://api.github.com/repos/symfony/Console/zipball/6f177fca24200a5b97aef5ce7a5c98124a0f0db0",
+ "reference": "6f177fca24200a5b97aef5ce7a5c98124a0f0db0",
"shasum": ""
},
"require": {
@@ -601,7 +601,7 @@
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
- "time": "2014-09-25 09:53:56"
+ "time": "2014-10-05 13:57:04"
},
{
"name": "tedivm/jshrink",
@@ -646,16 +646,16 @@
},
{
"name": "twig/twig",
- "version": "v1.16.1",
+ "version": "v1.16.2",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
- "reference": "7c4c01dcf578523cfcddf383641a4f12790270ec"
+ "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/7c4c01dcf578523cfcddf383641a4f12790270ec",
- "reference": "7c4c01dcf578523cfcddf383641a4f12790270ec",
+ "url": "https://api.github.com/repos/fabpot/Twig/zipball/42f758d9fe2146d1f0470604fc05ee43580873fc",
+ "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc",
"shasum": ""
},
"require": {
@@ -699,7 +699,7 @@
"keywords": [
"templating"
],
- "time": "2014-10-10 14:09:53"
+ "time": "2014-10-17 12:53:44"
}
],
"packages-dev": [
@@ -1292,16 +1292,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "4.3.3",
+ "version": "4.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "5a0bc4dcbb7340c0a9a9bc3507854a67c564edc4"
+ "reference": "23e4e0310f037aae873cc81b8658dbbb82878f71"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5a0bc4dcbb7340c0a9a9bc3507854a67c564edc4",
- "reference": "5a0bc4dcbb7340c0a9a9bc3507854a67c564edc4",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/23e4e0310f037aae873cc81b8658dbbb82878f71",
+ "reference": "23e4e0310f037aae873cc81b8658dbbb82878f71",
"shasum": ""
},
"require": {
@@ -1312,7 +1312,7 @@
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~2.0",
- "phpunit/php-file-iterator": "~1.3.1",
+ "phpunit/php-file-iterator": "~1.3.2",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/phpunit-mock-objects": "~2.3",
@@ -1362,7 +1362,7 @@
"testing",
"xunit"
],
- "time": "2014-10-16 16:53:00"
+ "time": "2014-10-22 11:43:12"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -1537,16 +1537,16 @@
},
{
"name": "sebastian/environment",
- "version": "1.1.0",
+ "version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7"
+ "reference": "0d9bf79554d2a999da194a60416c15cf461eb67d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7",
- "reference": "6288ebbf6fa3ed2b2ff2d69c356fbaaf4f0971a7",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0d9bf79554d2a999da194a60416c15cf461eb67d",
+ "reference": "0d9bf79554d2a999da194a60416c15cf461eb67d",
"shasum": ""
},
"require": {
@@ -1558,7 +1558,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "1.2.x-dev"
}
},
"autoload": {
@@ -1583,7 +1583,7 @@
"environment",
"hhvm"
],
- "time": "2014-10-07 09:23:16"
+ "time": "2014-10-22 06:38:05"
},
{
"name": "sebastian/exporter",
@@ -1687,17 +1687,17 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.5.5",
+ "version": "v2.5.6",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46"
+ "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f6281337bf5f985f585d1db6a83adb05ce531f46",
- "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/804eb28dbbfba9ffdab21fe2066744906cea2212",
+ "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212",
"shasum": ""
},
"require": {
@@ -1740,21 +1740,21 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
- "time": "2014-09-28 15:56:11"
+ "time": "2014-10-01 15:43:05"
},
{
"name": "symfony/yaml",
- "version": "v2.5.5",
+ "version": "v2.5.6",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96"
+ "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/b1dbc53593b98c2d694ebf383660ac9134d30b96",
- "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
+ "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
"shasum": ""
},
"require": {
@@ -1787,10 +1787,12 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2014-09-22 09:14:18"
+ "time": "2014-10-01 05:50:18"
}
],
- "aliases": [],
+ "aliases": [
+
+ ],
"minimum-stability": "stable",
"stability-flags": {
"mnapoli/php-di": 20,
@@ -1800,5 +1802,7 @@
"platform": {
"php": ">=5.3.3"
},
- "platform-dev": []
+ "platform-dev": [
+
+ ]
}
diff --git a/core/Exceptions/HtmlMessageException.php b/core/Exceptions/HtmlMessageException.php
index 69f809e1e0..243a0f1726 100644
--- a/core/Exceptions/HtmlMessageException.php
+++ b/core/Exceptions/HtmlMessageException.php
@@ -16,7 +16,15 @@ use Exception;
*
* @api
*/
-class HtmlMessageException extends Exception implements HtmlMessageExceptionInterface
+class HtmlMessageException extends Exception
{
- // empty
+ /**
+ * Returns the exception message.
+ *
+ * @return string
+ */
+ public function getHtmlMessage()
+ {
+ return $this->getMessage();
+ }
} \ No newline at end of file
diff --git a/core/Exceptions/HtmlMessageExceptionInterface.php b/core/Exceptions/HtmlMessageExceptionInterface.php
deleted file mode 100644
index b96c2e0a84..0000000000
--- a/core/Exceptions/HtmlMessageExceptionInterface.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- */
-namespace Piwik\Exceptions;
-
-/**
- * Exceptions that implement this interface are assumed to have HTML content
- * in their messages.
- *
- * @api
- */
-interface HtmlMessageExceptionInterface
-{
- // empty
-} \ No newline at end of file
diff --git a/core/FrontController.php b/core/FrontController.php
index 85fbbc8994..16d5930fe2 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -13,7 +13,6 @@ use Exception;
use Piwik\API\Request;
use Piwik\API\ResponseBuilder;
use Piwik\Exceptions\HtmlMessageException;
-use Piwik\Exceptions\HtmlMessageExceptionInterface;
use Piwik\Http\Router;
use Piwik\Plugin\Controller;
use Piwik\Plugin\Report;
@@ -615,8 +614,8 @@ class FrontController extends Singleton
{
$debugTrace = $ex->getTraceAsString();
- if ($ex instanceof HtmlMessageExceptionInterface) {
- $message = $ex->getMessage();
+ if (method_exists($ex, 'getHtmlMessage')) {
+ $message = $ex->getHtmlMessage();
} else {
$message = Common::sanitizeInputValue($ex->getMessage());
}
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php
index aa89483b62..9f8941170b 100644
--- a/core/Plugin/Manager.php
+++ b/core/Plugin/Manager.php
@@ -360,7 +360,7 @@ class Manager extends Singleton
if ($this->isPluginLoaded($pluginName)) {
throw new \Exception("To uninstall the plugin $pluginName, first disable it in Piwik > Settings > Plugins");
}
- $this->returnLoadedPluginsInfo();
+ $this->loadAllPluginsAndGetTheirInfo();
\Piwik\Settings\Manager::cleanupPluginSettings($pluginName);
@@ -541,7 +541,7 @@ class Manager extends Singleton
* See {@link Piwik\Plugin::getInformation()}.
* @api
*/
- public function returnLoadedPluginsInfo()
+ public function loadAllPluginsAndGetTheirInfo()
{
$language = Translate::getLanguageToLoad();
@@ -646,7 +646,7 @@ class Manager extends Singleton
{
$pluginsToLoad = array_unique($pluginsToLoad);
$this->pluginsToLoad = $pluginsToLoad;
- $this->reloadPlugins();
+ $this->reloadActivatedPlugins();
}
/**
@@ -828,7 +828,7 @@ class Manager extends Singleton
* Load the plugins classes installed.
* Register the observers for every plugin.
*/
- private function reloadPlugins()
+ private function reloadActivatedPlugins()
{
if ($this->doLoadAlwaysActivatedPlugins) {
$this->pluginsToLoad = array_merge($this->pluginsToLoad, $this->pluginToAlwaysActivate);
diff --git a/core/Url.php b/core/Url.php
index dd9503ca66..d57276d5a5 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -586,6 +586,9 @@ class Url
*/
public static function getHostSanitized($host)
{
+ if (!class_exists("Piwik\\Network\\IPUtils")) {
+ throw new Exception("Piwik\\Network\\IPUtils could not be found, maybe you are using Piwik from git and need to update Composer. $ php composer.phar update");
+ }
return IPUtils::sanitizeIp($host);
}
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index 4fc8f8a74b..8cff52d8d7 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -107,10 +107,8 @@ class Actions extends \Piwik\Plugin
$jsFiles[] = "plugins/Actions/javascripts/actionsDataTable.js";
}
- public function isSiteSearchEnabled()
+ public function isSiteSearchEnabled($idSites, $idSite)
{
- $idSite = Common::getRequestVar('idSite', 0, 'int');
- $idSites = Common::getRequestVar('idSites', '', 'string');
$idSites = Site::getIdSitesFromIdSitesString($idSites, true);
if (!empty($idSite)) {
diff --git a/plugins/Actions/Menu.php b/plugins/Actions/Menu.php
index e9ce436b75..9a7424b4e9 100644
--- a/plugins/Actions/Menu.php
+++ b/plugins/Actions/Menu.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\Actions;
+use Piwik\Common;
use Piwik\Menu\MenuReporting;
class Menu extends \Piwik\Plugin\Menu
@@ -16,8 +17,11 @@ class Menu extends \Piwik\Plugin\Menu
{
$menu->addActionsItem('', $this->urlForAction('menuGetPageUrls'), 15);
+ $idSite = Common::getRequestVar('idSite', 0, 'int');
+ $idSites = Common::getRequestVar('idSites', '', 'string');
+
$actions = new Actions();
- if ($actions->isSiteSearchEnabled()) {
+ if ($actions->isSiteSearchEnabled($idSites, $idSite)) {
$menu->addActionsItem('Actions_SubmenuSitesearch', $this->urlForAction('indexSiteSearch'), 5);
}
}
diff --git a/plugins/Actions/Reports/GetSiteSearchCategories.php b/plugins/Actions/Reports/GetSiteSearchCategories.php
index 5acf9e93ae..6d41e3c334 100644
--- a/plugins/Actions/Reports/GetSiteSearchCategories.php
+++ b/plugins/Actions/Reports/GetSiteSearchCategories.php
@@ -27,9 +27,9 @@ class GetSiteSearchCategories extends SiteSearchBase
$this->widgetTitle = 'Actions_WidgetSearchCategories';
}
- public function isEnabled()
+ protected function isEnabledForIdSites($idSites, $idSite)
{
- return parent::isEnabled() && Actions::isCustomVariablesPluginsEnabled();
+ return parent::isEnabledForIdSites($idSites, $idSite) && Actions::isCustomVariablesPluginsEnabled();
}
public function getMetrics()
diff --git a/plugins/Actions/Reports/SiteSearchBase.php b/plugins/Actions/Reports/SiteSearchBase.php
index 5212732e49..942710b792 100644
--- a/plugins/Actions/Reports/SiteSearchBase.php
+++ b/plugins/Actions/Reports/SiteSearchBase.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\Actions\Reports;
+use Piwik\Common;
use Piwik\Piwik;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\Actions\Actions;
@@ -22,8 +23,31 @@ abstract class SiteSearchBase extends Base
public function isEnabled()
{
+ $idSites = Common::getRequestVar('idSites', '', 'string');
+ $idSite = Common::getRequestVar('idSite', 0, 'int');
+
+ return $this->isEnabledForIdSites($idSites, $idSite);
+ }
+
+ protected function isEnabledForIdSites($idSites, $idSite)
+ {
$actions = new Actions();
- return $actions->isSiteSearchEnabled();
+ return $actions->isSiteSearchEnabled($idSites, $idSite);
+ }
+
+ public function configureReportMetadata(&$availableReports, $infos)
+ {
+ $idSites = !empty($infos['idSites']) ? $infos['idSites'] : array();
+
+ if (!$this->isEnabledForIdSites($idSites, 0)) {
+ return;
+ }
+
+ $report = $this->buildReportMetadata();
+
+ if (!empty($report)) {
+ $availableReports[] = $report;
+ }
}
protected function addSiteSearchDisplayProperties(ViewDataTable $view)
diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php
index 245a24ce11..b87fc91579 100644
--- a/plugins/CorePluginsAdmin/Controller.php
+++ b/plugins/CorePluginsAdmin/Controller.php
@@ -284,7 +284,7 @@ class Controller extends Plugin\ControllerAdmin
protected function getPluginsInfo($themesOnly = false)
{
$pluginManager = \Piwik\Plugin\Manager::getInstance();
- $plugins = $pluginManager->returnLoadedPluginsInfo();
+ $plugins = $pluginManager->loadAllPluginsAndGetTheirInfo();
foreach ($plugins as $pluginName => &$plugin) {
@@ -370,7 +370,7 @@ class Controller extends Plugin\ControllerAdmin
$view->lastError = $lastError;
$view->isSuperUser = Piwik::hasUserSuperUserAccess();
$view->isAnonymousUser = Piwik::isUserIsAnonymous();
- $view->plugins = Plugin\Manager::getInstance()->returnLoadedPluginsInfo();
+ $view->plugins = Plugin\Manager::getInstance()->loadAllPluginsAndGetTheirInfo();
$view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE);
$view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE);
$view->emailSuperUser = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
diff --git a/plugins/CorePluginsAdmin/Marketplace.php b/plugins/CorePluginsAdmin/Marketplace.php
index 3b876131cf..6cb5a28105 100644
--- a/plugins/CorePluginsAdmin/Marketplace.php
+++ b/plugins/CorePluginsAdmin/Marketplace.php
@@ -105,7 +105,7 @@ class Marketplace
public function getPluginsHavingUpdate($themesOnly)
{
$pluginManager = \Piwik\Plugin\Manager::getInstance();
- $pluginManager->returnLoadedPluginsInfo();
+ $pluginManager->loadAllPluginsAndGetTheirInfo();
$loadedPlugins = $pluginManager->getLoadedPlugins();
try {
diff --git a/plugins/Installation/templates/_systemCheckSection.twig b/plugins/Installation/templates/_systemCheckSection.twig
index fb2d26a3aa..22247455ae 100755
--- a/plugins/Installation/templates/_systemCheckSection.twig
+++ b/plugins/Installation/templates/_systemCheckSection.twig
@@ -5,7 +5,7 @@
<table class="infosServer" id="systemCheckRequired">
<tr>
- {% set MinPHP %}{{ 'Installation_SystemCheckPhp'|translate }} &gt; {{ infos.phpVersion_minimum }}{% endset %}
+ {% set MinPHP %}{{ 'Installation_SystemCheckPhp'|translate }} &gt;= {{ infos.phpVersion_minimum }}{% endset %}
<td class="label">{{ MinPHP }}</td>
<td>
diff --git a/plugins/TestRunner/Aws/Instance.php b/plugins/TestRunner/Aws/Instance.php
index 8afa292b66..622f7cf9bf 100644
--- a/plugins/TestRunner/Aws/Instance.php
+++ b/plugins/TestRunner/Aws/Instance.php
@@ -128,15 +128,21 @@ class Instance
{
$instances = $resources->getPath('Reservations/*/Instances');
+ if (empty($instances)) {
+ return;
+ }
+
$instanceToUse = null;
foreach ($instances as $index => $instance) {
- foreach ($instance['Tags'] as $tag) {
- if (!empty($this->testSuite)
- && $tag['Key'] === 'TestSuite'
- && $tag['Value'] === $this->testSuite) {
-
- $instanceToUse = $instance;
+ if (!empty($instance['Tags'])) {
+ foreach ($instance['Tags'] as $tag) {
+ if (!empty($this->testSuite)
+ && $tag['Key'] === 'TestSuite'
+ && $tag['Value'] === $this->testSuite) {
+
+ $instanceToUse = $instance;
+ }
}
}
}
diff --git a/plugins/TestRunner/Runner/Remote.php b/plugins/TestRunner/Runner/Remote.php
index 04753d6cea..63fe7a4963 100644
--- a/plugins/TestRunner/Runner/Remote.php
+++ b/plugins/TestRunner/Runner/Remote.php
@@ -78,6 +78,8 @@ class Remote
private function doRunTests($testSuite)
{
+ $this->ssh->exec("ps -ef | grep \"php console tests:run\" | grep -v grep | awk '{print $2}' | xargs kill -9");
+
if ('all' === $testSuite) {
$this->ssh->exec('php console tests:run --options="--colors"');
} elseif ('ui' === $testSuite) {
diff --git a/tests/PHPUnit/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt b/tests/PHPUnit/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt
index 16bfe19f8c..814737fdd4 100644
--- a/tests/PHPUnit/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt
+++ b/tests/PHPUnit/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt
@@ -1,8 +1,8 @@
-------------------------------------------------------
Using this 'archive.php' script is no longer recommended.
-Please use '/path/to/php /home/matt/dev/piwik-master/tests/PHPUnit/proxy/../../..//console core:archive --url=http://localhost/piwik-master/tests/PHPUnit/proxy/index.php' instead.
-To get help use '/path/to/php /home/matt/dev/piwik-master/tests/PHPUnit/proxy/../../..//console core:archive --help'
+Please use '/path/to/php /home/travis/build/piwik/piwik/tests/PHPUnit/proxy/../../..//console core:archive --url=http://localhost/tests/PHPUnit/proxy/index.php' instead.
+To get help use '/path/to/php /home/travis/build/piwik/piwik/tests/PHPUnit/proxy/../../..//console core:archive --help'
See also: http://piwik.org/docs/setup-auto-archiving/
If you cannot use the console because it requires CLI
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_csv__ScheduledReports.generateReport_month.original.csv b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_csv__ScheduledReports.generateReport_month.original.csv
index ed01b69d09..4a6e7f01e5 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_csv__ScheduledReports.generateReport_month.original.csv
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_csv__ScheduledReports.generateReport_month.original.csv
@@ -197,6 +197,21 @@ No data available
Event Names
No data available
+Site Search Keywords
+No data available
+
+Search Keywords with No Results
+No data available
+
+Search Categories
+No data available
+
+Pages Following a Site Search
+No data available
+
+Page Titles Following a Site Search
+No data available
+
Referrer Type
label,nb_visits,nb_actions,nb_actions_per_visit,avg_time_on_site,bounce_rate,revenue
Websites,5,22,4.4,00:13:13,0%,$ 0
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
index 2a1c671ffd..eedeaebeae 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
@@ -170,6 +170,31 @@
</a>
</li>
<li>
+ <a href="#Actions_getSiteSearchKeywords" style="text-decoration:none; color: rgb(68,68,68);">
+ Site Search Keywords
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getSiteSearchNoResultKeywords" style="text-decoration:none; color: rgb(68,68,68);">
+ Search Keywords with No Results
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getSiteSearchCategories" style="text-decoration:none; color: rgb(68,68,68);">
+ Search Categories
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getPageUrlsFollowingSiteSearch" style="text-decoration:none; color: rgb(68,68,68);">
+ Pages Following a Site Search
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getPageTitlesFollowingSiteSearch" style="text-decoration:none; color: rgb(68,68,68);">
+ Page Titles Following a Site Search
+ </a>
+ </li>
+ <li>
<a href="#Referrers_getReferrerType" style="text-decoration:none; color: rgb(68,68,68);">
Referrer Type
</a>
@@ -3603,6 +3628,31 @@
</h2>
There is no data for this report.
+<h2 id="Actions_getSiteSearchKeywords" style="color: rgb(126,115,99); font-size: 11pt;">
+ Site Search Keywords
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getSiteSearchNoResultKeywords" style="color: rgb(126,115,99); font-size: 11pt;">
+ Search Keywords with No Results
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getSiteSearchCategories" style="color: rgb(126,115,99); font-size: 11pt;">
+ Search Categories
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getPageUrlsFollowingSiteSearch" style="color: rgb(126,115,99); font-size: 11pt;">
+ Pages Following a Site Search
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getPageTitlesFollowingSiteSearch" style="color: rgb(126,115,99); font-size: 11pt;">
+ Page Titles Following a Site Search
+</h2>
+
+ There is no data for this report.
<h2 id="Referrers_getReferrerType" style="color: rgb(126,115,99); font-size: 11pt;">
Referrer Type
</h2>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv
index 69bb6fd4f6..9927d8b38b 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_csv__ScheduledReports.generateReport_week.original.csv
@@ -288,6 +288,21 @@ No data available
Event Names
No data available
+Site Search Keywords
+No data available
+
+Search Keywords with No Results
+No data available
+
+Search Categories
+No data available
+
+Pages Following a Site Search
+No data available
+
+Page Titles Following a Site Search
+No data available
+
Referrer Type
label,nb_visits,nb_actions,revenue,nb_actions_per_visit,avg_time_on_site,bounce_rate
Direct Entry,5,16,$ 13361.11,3.2,00:22:49,20%
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
index 3b420d327e..d8f071033a 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
@@ -215,6 +215,31 @@
</a>
</li>
<li>
+ <a href="#Actions_getSiteSearchKeywords" style="text-decoration:none; color: rgb(68,68,68);">
+ Site Search Keywords
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getSiteSearchNoResultKeywords" style="text-decoration:none; color: rgb(68,68,68);">
+ Search Keywords with No Results
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getSiteSearchCategories" style="text-decoration:none; color: rgb(68,68,68);">
+ Search Categories
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getPageUrlsFollowingSiteSearch" style="text-decoration:none; color: rgb(68,68,68);">
+ Pages Following a Site Search
+ </a>
+ </li>
+ <li>
+ <a href="#Actions_getPageTitlesFollowingSiteSearch" style="text-decoration:none; color: rgb(68,68,68);">
+ Page Titles Following a Site Search
+ </a>
+ </li>
+ <li>
<a href="#Referrers_getReferrerType" style="text-decoration:none; color: rgb(68,68,68);">
Referrer Type
</a>
@@ -4650,6 +4675,31 @@
</h2>
There is no data for this report.
+<h2 id="Actions_getSiteSearchKeywords" style="color: rgb(126,115,99); font-size: 11pt;">
+ Site Search Keywords
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getSiteSearchNoResultKeywords" style="color: rgb(126,115,99); font-size: 11pt;">
+ Search Keywords with No Results
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getSiteSearchCategories" style="color: rgb(126,115,99); font-size: 11pt;">
+ Search Categories
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getPageUrlsFollowingSiteSearch" style="color: rgb(126,115,99); font-size: 11pt;">
+ Pages Following a Site Search
+</h2>
+
+ There is no data for this report.
+<h2 id="Actions_getPageTitlesFollowingSiteSearch" style="color: rgb(126,115,99); font-size: 11pt;">
+ Page Titles Following a Site Search
+</h2>
+
+ There is no data for this report.
<h2 id="Referrers_getReferrerType" style="color: rgb(126,115,99); font-size: 11pt;">
Referrer Type
</h2>
diff --git a/tests/PHPUnit/Unit/API/ApiRendererTest.php b/tests/PHPUnit/Unit/API/ApiRendererTest.php
index ebe1952a90..1434e34ff4 100644
--- a/tests/PHPUnit/Unit/API/ApiRendererTest.php
+++ b/tests/PHPUnit/Unit/API/ApiRendererTest.php
@@ -6,35 +6,38 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\API;
+
use Piwik\API\ApiRenderer;
+use Piwik\Plugin\Manager;
/**
* @group Core
* @group Only2
*/
-class ApiRendererTest extends PHPUnit_Framework_TestCase
+class ApiRendererTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
- \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('API'));
+ Manager::getInstance()->loadPlugins(array('API'));
}
public function test_factory_shouldCreateAnInstance_IfValidFormatGiven()
{
$renderer = ApiRenderer::factory('php', array());
- $this->assertInstanceOf('\\Piwik\\Plugins\\API\\Renderer\\Php', $renderer);
+ $this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('PHP', array());
- $this->assertInstanceOf('\\Piwik\\Plugins\\API\\Renderer\\Php', $renderer);
+ $this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('pHp', array());
- $this->assertInstanceOf('\\Piwik\\Plugins\\API\\Renderer\\Php', $renderer);
+ $this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('xmL', array());
- $this->assertInstanceOf('\\Piwik\\Plugins\\API\\Renderer\\Xml', $renderer);
+ $this->assertInstanceOf('Piwik\Plugins\API\Renderer\Xml', $renderer);
$renderer = ApiRenderer::factory('OriginAl', array());
- $this->assertInstanceOf('\\Piwik\\Plugins\\API\\Renderer\\Original', $renderer);
+ $this->assertInstanceOf('Piwik\Plugins\API\Renderer\Original', $renderer);
}
/**
diff --git a/tests/PHPUnit/Unit/API/ResponseBuilderTest.php b/tests/PHPUnit/Unit/API/ResponseBuilderTest.php
index 9d6d0bc779..d9e6769818 100644
--- a/tests/PHPUnit/Unit/API/ResponseBuilderTest.php
+++ b/tests/PHPUnit/Unit/API/ResponseBuilderTest.php
@@ -6,17 +6,21 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\API;
+
+use Exception;
use Piwik\API\ResponseBuilder;
use Piwik\DataTable;
+use Piwik\Plugin\Manager;
/**
* @group Core
*/
-class ResponseBuilderTest extends PHPUnit_Framework_TestCase
+class ResponseBuilderTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
- \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('API'));
+ Manager::getInstance()->loadPlugins(array('API'));
}
public function test_getResponseException_shouldFormatExceptionDependingOnFormatAndAddDebugHelp()
diff --git a/tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php b/tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php
index 2dd91867f2..7aeaeb0f66 100644
--- a/tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php
+++ b/tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\AssetManager;
+
use Piwik\Plugin\Manager;
use Piwik\Plugin;
use Piwik\Theme;
diff --git a/tests/PHPUnit/Unit/AssetManager/PluginMock.php b/tests/PHPUnit/Unit/AssetManager/PluginMock.php
index 6b6e8919ab..c29c03dd67 100644
--- a/tests/PHPUnit/Unit/AssetManager/PluginMock.php
+++ b/tests/PHPUnit/Unit/AssetManager/PluginMock.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\AssetManager;
+
use Piwik\Plugin;
class PluginMock extends Plugin
diff --git a/tests/PHPUnit/Unit/AssetManager/ThemeMock.php b/tests/PHPUnit/Unit/AssetManager/ThemeMock.php
index 213a14d737..5c2d59a22d 100644
--- a/tests/PHPUnit/Unit/AssetManager/ThemeMock.php
+++ b/tests/PHPUnit/Unit/AssetManager/ThemeMock.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\AssetManager;
+
use Piwik\Plugin;
use Piwik\Theme;
diff --git a/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php b/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php
index c6d2205aae..b0ebf13f88 100644
--- a/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php
+++ b/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\AssetManager;
+
use Piwik\AssetManager\UIAssetCacheBuster;
class UIAssetCacheBusterMock extends UIAssetCacheBuster
diff --git a/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterTest.php b/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterTest.php
index 85c4b613b3..b71903b7fa 100644
--- a/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterTest.php
+++ b/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterTest.php
@@ -6,11 +6,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\AssetManager;
+
+use PHPUnit_Framework_TestCase;
use Piwik\AssetManager\UIAssetCacheBuster;
class UIAssetCacheBusterTest extends PHPUnit_Framework_TestCase
{
-
/**
* @var UIAssetCacheBuster
*/
diff --git a/tests/PHPUnit/Unit/AssetManager/UIAssetCatalogSorterTest.php b/tests/PHPUnit/Unit/AssetManager/UIAssetCatalogSorterTest.php
index 820d8161bf..8bf96d8f4a 100644
--- a/tests/PHPUnit/Unit/AssetManager/UIAssetCatalogSorterTest.php
+++ b/tests/PHPUnit/Unit/AssetManager/UIAssetCatalogSorterTest.php
@@ -5,6 +5,10 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\AssetManager;
+
+use PHPUnit_Framework_TestCase;
use Piwik\AssetManager\UIAsset\OnDiskUIAsset;
use Piwik\AssetManager\UIAssetCatalog;
use Piwik\AssetManager\UIAssetCatalogSorter;
diff --git a/tests/PHPUnit/Unit/AssetManagerTest.php b/tests/PHPUnit/Unit/AssetManagerTest.php
index ca1ca94433..18c61cf18c 100644
--- a/tests/PHPUnit/Unit/AssetManagerTest.php
+++ b/tests/PHPUnit/Unit/AssetManagerTest.php
@@ -5,6 +5,10 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
+use PHPUnit_Framework_TestCase;
use Piwik\AssetManager\UIAsset\OnDiskUIAsset;
use Piwik\AssetManager\UIAsset;
use Piwik\AssetManager;
@@ -13,11 +17,10 @@ use Piwik\Config;
use Piwik\Plugin;
use Piwik\Plugin\Manager;
use Piwik\EventDispatcher;
-
-require_once PIWIK_INCLUDE_PATH . "/tests/PHPUnit/Unit/AssetManager/UIAssetCacheBusterMock.php";
-require_once PIWIK_INCLUDE_PATH . "/tests/PHPUnit/Unit/AssetManager/PluginManagerMock.php";
-require_once PIWIK_INCLUDE_PATH . "/tests/PHPUnit/Unit/AssetManager/PluginMock.php";
-require_once PIWIK_INCLUDE_PATH . "/tests/PHPUnit/Unit/AssetManager/ThemeMock.php";
+use Piwik\Tests\Unit\AssetManager\PluginManagerMock;
+use Piwik\Tests\Unit\AssetManager\PluginMock;
+use Piwik\Tests\Unit\AssetManager\ThemeMock;
+use Piwik\Tests\Unit\AssetManager\UIAssetCacheBusterMock;
/**
* @group AssetManagerTest
@@ -50,12 +53,12 @@ class AssetManagerTest extends PHPUnit_Framework_TestCase
private $mergedAsset;
/**
- * @var UIAssetCacheBusterMock
+ * @var \Piwik\Tests\Unit\AssetManager\UIAssetCacheBusterMock
*/
private $cacheBuster;
/**
- * @var PluginManagerMock
+ * @var \Piwik\Tests\Unit\AssetManager\PluginManagerMock
*/
private $pluginManager;
diff --git a/tests/PHPUnit/Unit/CliMulti/OutputTest.php b/tests/PHPUnit/Unit/CliMulti/OutputTest.php
index 355fe2c4c7..6dbcf12179 100644
--- a/tests/PHPUnit/Unit/CliMulti/OutputTest.php
+++ b/tests/PHPUnit/Unit/CliMulti/OutputTest.php
@@ -5,15 +5,17 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\CliMulti;
+
use Piwik\CliMulti\Output;
+use Piwik\Url;
/**
- * Class OutputTest
* @group Core
*/
-class OutputTest extends PHPUnit_Framework_TestCase
+class OutputTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @var Output
*/
@@ -21,7 +23,7 @@ class OutputTest extends PHPUnit_Framework_TestCase
public function setUp()
{
- \Piwik\Url::setHost(false);
+ Url::setHost(false);
$this->output = new Output('myid');
}
diff --git a/tests/PHPUnit/Unit/CliMulti/ProcessTest.php b/tests/PHPUnit/Unit/CliMulti/ProcessTest.php
index bc00463e3a..3db93081c6 100644
--- a/tests/PHPUnit/Unit/CliMulti/ProcessTest.php
+++ b/tests/PHPUnit/Unit/CliMulti/ProcessTest.php
@@ -6,13 +6,15 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\CliMulti;
+
use Piwik\CliMulti\Process;
+use ReflectionProperty;
/**
- * Class ProcessTest
* @group Core
*/
-class ProcessTest extends PHPUnit_Framework_TestCase
+class ProcessTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Process
diff --git a/tests/PHPUnit/Unit/Columns/DimensionTest.php b/tests/PHPUnit/Unit/Columns/DimensionTest.php
index cf0da5ff94..50a818cc55 100644
--- a/tests/PHPUnit/Unit/Columns/DimensionTest.php
+++ b/tests/PHPUnit/Unit/Columns/DimensionTest.php
@@ -43,7 +43,7 @@ namespace Piwik\Plugins\Test\Columns
}
}
-namespace Piwik\Tests\Core\Columns
+namespace Piwik\Tests\Unit\Columns
{
use Piwik\Columns\Dimension;
use Piwik\Config;
diff --git a/tests/PHPUnit/Unit/CommonTest.php b/tests/PHPUnit/Unit/CommonTest.php
index 185fa064d3..5e820a25fd 100644
--- a/tests/PHPUnit/Unit/CommonTest.php
+++ b/tests/PHPUnit/Unit/CommonTest.php
@@ -1,15 +1,21 @@
<?php
-use Piwik\Common;
-use Piwik\Filesystem;
-
/**
* Piwik - free/libre analytics platform
*
- * @backupGlobals enabled
- *
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
+use Exception;
+use PHPUnit_Framework_TestCase;
+use Piwik\Common;
+use Piwik\Filesystem;
+
+/**
+ * @backupGlobals enabled
+ */
class Core_CommonTest extends PHPUnit_Framework_TestCase
{
/**
diff --git a/tests/PHPUnit/Unit/ConfigTest.php b/tests/PHPUnit/Unit/ConfigTest.php
index 128e198eeb..3543871b1f 100644
--- a/tests/PHPUnit/Unit/ConfigTest.php
+++ b/tests/PHPUnit/Unit/ConfigTest.php
@@ -6,6 +6,9 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit;
+
+use PHPUnit_Framework_TestCase;
use Piwik\Config;
/**
diff --git a/tests/PHPUnit/Unit/CookieTest.php b/tests/PHPUnit/Unit/CookieTest.php
index 9b77aeddaf..52adec4d0e 100644
--- a/tests/PHPUnit/Unit/CookieTest.php
+++ b/tests/PHPUnit/Unit/CookieTest.php
@@ -5,7 +5,10 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class CookieTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+class CookieTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testJsonSerialize
@@ -41,11 +44,6 @@ class CookieTest extends PHPUnit_Framework_TestCase
*/
public function testJsonSerialize($testData, $id)
{
- // @see http://bugs.php.net/38680
- if (PHP_VERSION >= '5.2.0' && PHP_VERSION < '5.2.1') {
- $this->markTestSkipped('see http://bugs.php.net/38680');
- }
-
$this->assertEquals($testData, json_decode(json_encode($testData), $assoc = true), $id);
}
@@ -95,7 +93,7 @@ class CookieTest extends PHPUnit_Framework_TestCase
public function testSafeUnserialize()
{
/*
- * serialize() uses its internal maachine representation when floats expressed in E-notation,
+ * serialize() uses its internal machine representation when floats expressed in E-notation,
* which may vary between php versions, OS, and hardware platforms
*/
$testData = -5.0E+142;
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php b/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php
index 71b41bd429..f072011675 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php
@@ -5,10 +5,13 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_AddSummaryRowTest extends \PHPUnit_Framework_TestCase
{
/**
* @group AddSummaryRow
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php b/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php
index 469015a24c..6e8eb733b8 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php
@@ -5,11 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable\Filter\ExcludeLowPopulation;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_ExcludeLowPopulationTest extends \PHPUnit_Framework_TestCase
{
protected function getTestDataTable()
{
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php b/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php
index 14705926a5..94d2d4c84b 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php
@@ -5,11 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable\Filter\Limit;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_LimitTest extends \PHPUnit_Framework_TestCase
{
/**
* Returns table used for the tests
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php
index 7ab59d8c4a..4c9cd46ab3 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php
@@ -5,10 +5,13 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_PatternRecursiveTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_PatternRecursiveTest extends \PHPUnit_Framework_TestCase
{
/**
* Returns a data table for testing
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php
index 1f1c25bc61..e9d63f1d98 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php
@@ -5,10 +5,13 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_PatternTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_PatternTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testFilterPattern
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php b/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php
index e9140c3aed..3c1d91a357 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php
@@ -5,11 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable\Filter\RangeCheck;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_RangeCheckTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_RangeCheckTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php b/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php
index bf23dbd7dc..4aedcb3d7e 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php
@@ -5,11 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable\Filter\Sort;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_SortTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
diff --git a/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php b/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php
index 2cb53e701f..d82e8da441 100644
--- a/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php
@@ -5,11 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Filter;
+
use Piwik\DataTable\Filter\Truncate;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class DataTable_Filter_TruncateTest extends PHPUnit_Framework_TestCase
+class DataTable_Filter_TruncateTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
diff --git a/tests/PHPUnit/Unit/DataTable/MapTest.php b/tests/PHPUnit/Unit/DataTable/MapTest.php
index de08a14787..659e76ac8f 100644
--- a/tests/PHPUnit/Unit/DataTable/MapTest.php
+++ b/tests/PHPUnit/Unit/DataTable/MapTest.php
@@ -1,10 +1,13 @@
<?php
+
+namespace Piwik\Tests\Unit\DataTable;
+
use Piwik\Config;
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Row;
-class Test_DataTable_Map extends PHPUnit_Framework_TestCase
+class Test_DataTable_Map extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
@@ -74,7 +77,7 @@ class Test_DataTable_Map extends PHPUnit_Framework_TestCase
$this->mergeChildren_checkRow($result->getRowFromId(3), 'subDataTable2', 2);
}
- private function mergeChildren_checkRow($row, $expectedLabel, $expectedColumnValue)
+ private function mergeChildren_checkRow(Row $row, $expectedLabel, $expectedColumnValue)
{
$this->assertEquals($expectedLabel, $row->getColumn('label'));
$this->assertEquals($expectedColumnValue, $row->getColumn('col1'));
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
index 64ffcf6a06..85691cab26 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php
@@ -5,13 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Renderer;
+
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Renderer\Csv;
use Piwik\DataTable\Row;
use Piwik\DataTable\Simple;
-class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
+class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php
index 7da7dedb53..686f6a1be6 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php
@@ -5,12 +5,15 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Renderer;
+
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Renderer\Console;
use Piwik\DataTable\Row;
-class DataTable_Renderer_ConsoleTest extends PHPUnit_Framework_TestCase
+class DataTable_Renderer_ConsoleTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php
index c18ee12e60..738439474c 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php
@@ -5,13 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Renderer;
+
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Renderer\Json;
use Piwik\DataTable\Row;
use Piwik\DataTable\Simple;
-class DataTable_Renderer_JSONTest extends PHPUnit_Framework_TestCase
+class DataTable_Renderer_JSONTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php
index 7ba4088e5c..e3201dfbe6 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php
@@ -5,13 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Renderer;
+
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Renderer\Php;
use Piwik\DataTable\Row;
use Piwik\DataTable\Simple;
-class DataTable_Renderer_PHPTest extends PHPUnit_Framework_TestCase
+class DataTable_Renderer_PHPTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php
index f8c2a93072..1abfe94b06 100644
--- a/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php
+++ b/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php
@@ -5,13 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable\Renderer;
+
use Piwik\DataTable\Manager;
use Piwik\DataTable;
use Piwik\DataTable\Renderer\Xml;
use Piwik\DataTable\Row;
use Piwik\DataTable\Simple;
-class DataTable_Renderer_XMLTest extends PHPUnit_Framework_TestCase
+class DataTable_Renderer_XMLTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/DataTable/RowTest.php b/tests/PHPUnit/Unit/DataTable/RowTest.php
index 629a10a280..53a072fa36 100644
--- a/tests/PHPUnit/Unit/DataTable/RowTest.php
+++ b/tests/PHPUnit/Unit/DataTable/RowTest.php
@@ -5,13 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\DataTable;
+
use Piwik\DataTable;
use Piwik\DataTable\Row;
/**
* @group Core
*/
-class RowTest extends PHPUnit_Framework_TestCase
+class RowTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Row
diff --git a/tests/PHPUnit/Unit/DataTableTest.php b/tests/PHPUnit/Unit/DataTableTest.php
index 1465f70a7b..355b717118 100644
--- a/tests/PHPUnit/Unit/DataTableTest.php
+++ b/tests/PHPUnit/Unit/DataTableTest.php
@@ -6,13 +6,15 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit;
+
use Piwik\Common;
use Piwik\DataTable\Manager;
use Piwik\DataTable\Row;
use Piwik\DataTable;
use Piwik\Timer;
-class DataTableTest extends PHPUnit_Framework_TestCase
+class DataTableTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
@@ -311,7 +313,7 @@ class DataTableTest extends PHPUnit_Framework_TestCase
*
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
*/
public function testSumRow_stringException()
{
@@ -335,7 +337,7 @@ class DataTableTest extends PHPUnit_Framework_TestCase
*
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
*/
public function testSerializeWithInfiniteRecursion()
{
diff --git a/tests/PHPUnit/Unit/DateTest.php b/tests/PHPUnit/Unit/DateTest.php
index 84041f53fd..9f2c286342 100644
--- a/tests/PHPUnit/Unit/DateTest.php
+++ b/tests/PHPUnit/Unit/DateTest.php
@@ -5,13 +5,17 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
+use Exception;
use Piwik\Date;
use Piwik\SettingsServer;
/**
* @group Core_DateTest
*/
-class DateTest extends PHPUnit_Framework_TestCase
+class DateTest extends \PHPUnit_Framework_TestCase
{
/**
* create today object check that timestamp is correct (midnight)
diff --git a/tests/PHPUnit/Unit/DependencyTest.php b/tests/PHPUnit/Unit/DependencyTest.php
index 3c7b783e95..37912aee39 100644
--- a/tests/PHPUnit/Unit/DependencyTest.php
+++ b/tests/PHPUnit/Unit/DependencyTest.php
@@ -1,16 +1,21 @@
<?php
-use Piwik\Plugin\Dependency;
-use Piwik\Plugin\Manager as PluginManager;
-use Piwik\Version;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\Plugin\Dependency;
+use Piwik\Plugin\Manager as PluginManager;
+use Piwik\Version;
+
+/**
* @group Core
*/
-class DependencyTest extends PHPUnit_Framework_TestCase
+class DependencyTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Dependency
@@ -112,7 +117,7 @@ class DependencyTest extends PHPUnit_Framework_TestCase
public function test_getMissingDependencies_detectsPluginVersion()
{
- PluginManager::getInstance()->returnLoadedPluginsInfo();
+ PluginManager::getInstance()->loadAllPluginsAndGetTheirInfo();
$this->assertMissingDependency(array('Annotations' => '>=2.1'), array());
$this->assertMissingDependency(array('Annotations' => '>=' . Version::VERSION), array());
diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
index 82e564cb95..46dfca652f 100644
--- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
+++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
@@ -5,29 +5,30 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\AssetManager;
use Piwik\AssetManager\UIAsset;
+use Piwik\Date;
use Piwik\Plugin;
+use Piwik\Version;
+use ReflectionClass;
/**
* @group Core
*/
-class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase
+class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase
{
-
public function test_version2_0_4()
{
- $validTill = '2014-11-02';
+ $validTill = '2014-11-25';
$this->assertDeprecatedMethodIsRemoved('\Piwik\Period', 'factory', $validTill);
-
- $validTill = '2014-11-02';
$this->assertDeprecatedMethodIsRemoved('\Piwik\Config', 'getConfigSuperUserForBackwardCompatibility', $validTill);
$this->assertDeprecatedMethodIsRemoved('\Piwik\Menu\MenuAdmin', 'addEntry', $validTill);
$this->assertDeprecatedMethodIsRemoved('\Piwik\Menu\MenuAdmin', 'removeEntry', $validTill);
$this->assertDeprecatedMethodIsRemoved('\Piwik\Menu\MenuTop', 'addEntry', $validTill);
$this->assertDeprecatedMethodIsRemoved('\Piwik\Menu\MenuTop', 'removeEntry', $validTill);
-
- $validTill = '2014-11-02';
$this->assertDeprecatedMethodIsRemoved('\Piwik\SettingsPiwik', 'rewriteTmpPathWithHostname', $validTill);
$validTill = '2015-02-06';
@@ -59,8 +60,8 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase
private function assertDeprecatedMethodIsRemoved($className, $method, $removalDate)
{
- $now = \Piwik\Date::now();
- $removalDate = \Piwik\Date::factory($removalDate);
+ $now = Date::now();
+ $removalDate = Date::factory($removalDate);
$class = new ReflectionClass($className);
$methodExists = $class->hasMethod($method);
@@ -79,8 +80,8 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase
private function assertDeprecatedClassIsRemoved($className, $removalDate)
{
- $now = \Piwik\Date::now();
- $removalDate = \Piwik\Date::factory($removalDate);
+ $now = Date::now();
+ $removalDate = Date::factory($removalDate);
$classExists = class_exists($className);
@@ -97,7 +98,7 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase
private function assertDeprecatedMethodIsRemovedInPiwik3($className, $method)
{
- $version = \Piwik\Version::VERSION;
+ $version = Version::VERSION;
$class = new ReflectionClass($className);
$methodExists = $class->hasMethod($method);
diff --git a/tests/PHPUnit/Unit/FactoryTest.php b/tests/PHPUnit/Unit/FactoryTest.php
index d85efcc2ce..056b08c618 100644
--- a/tests/PHPUnit/Unit/FactoryTest.php
+++ b/tests/PHPUnit/Unit/FactoryTest.php
@@ -6,28 +6,29 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit;
+
use Piwik\BaseFactory;
/**
* @group Core
- * @group Core_FactoryTest
*/
-class FactoryTest extends PHPUnit_Framework_TestCase
+class FactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreatingExistingClassSucceeds()
{
- $instance = BaseFactory::factory("Piwik\\Timer");
+ $instance = BaseFactory::factory('Piwik\Timer');
$this->assertNotNull($instance);
- $this->assertInstanceOf("Piwik\\Timer", $instance);
+ $this->assertInstanceOf('Piwik\Timer', $instance);
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage Invalid class ID
*/
public function testCreatingInvalidClassThrows()
{
BaseFactory::factory("This\\Class\\Does\\Not\\Exist");
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Unit/FilesystemTest.php b/tests/PHPUnit/Unit/FilesystemTest.php
index 26518c1a08..263a268bbd 100644
--- a/tests/PHPUnit/Unit/FilesystemTest.php
+++ b/tests/PHPUnit/Unit/FilesystemTest.php
@@ -5,12 +5,15 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\Filesystem;
/**
* @group Core
*/
-class FilesystemTest extends PHPUnit_Framework_TestCase
+class FilesystemTest extends \PHPUnit_Framework_TestCase
{
private $testPath;
diff --git a/tests/PHPUnit/Unit/IPTest.php b/tests/PHPUnit/Unit/IPTest.php
index b542a74ab2..a78d7ddeca 100644
--- a/tests/PHPUnit/Unit/IPTest.php
+++ b/tests/PHPUnit/Unit/IPTest.php
@@ -8,11 +8,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit;
+
use Piwik\Common;
use Piwik\Config;
use Piwik\IP;
-class IPTest extends PHPUnit_Framework_TestCase
+class IPTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for long2ip test
diff --git a/tests/PHPUnit/Unit/Menu/MenuReportingTest.php b/tests/PHPUnit/Unit/Menu/MenuReportingTest.php
index b82c4a1aaf..78d26b6427 100644
--- a/tests/PHPUnit/Unit/Menu/MenuReportingTest.php
+++ b/tests/PHPUnit/Unit/Menu/MenuReportingTest.php
@@ -6,19 +6,21 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\Menu;
+
use Piwik\Access;
use Piwik\Plugin\Report;
use Piwik\Piwik;
use Piwik\Metrics;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Translate;
use Piwik\Menu\MenuReporting;
use Piwik\Plugin\Manager as PluginManager;
-
/**
* @group Core
*/
-class Menu_ReportingTest extends PHPUnit_Framework_TestCase
+class ReportingTest extends \PHPUnit_Framework_TestCase
{
/**
* @var MenuReporting
diff --git a/tests/PHPUnit/Unit/MetricsTest.php b/tests/PHPUnit/Unit/MetricsTest.php
index c7052102e8..610e1cf459 100644
--- a/tests/PHPUnit/Unit/MetricsTest.php
+++ b/tests/PHPUnit/Unit/MetricsTest.php
@@ -1,14 +1,19 @@
<?php
-use Piwik\Access;
-use Piwik\Metrics;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class Core_MetricsTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\Access;
+use Piwik\Metrics;
+use Piwik\Site;
+use Piwik\Tests\Framework\Mock\FakeAccess;
+
+class Core_MetricsTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
@@ -117,7 +122,7 @@ class Core_MetricsTest extends PHPUnit_Framework_TestCase
*/
public function testGetUnit($column, $expected)
{
- \Piwik\Site::setSites(array(
+ Site::setSites(array(
1 => array('name' => 'TestSite', 'currency' => 'EUR')
));
diff --git a/tests/PHPUnit/Unit/NonceTest.php b/tests/PHPUnit/Unit/NonceTest.php
index 6a9a90994c..c12c245ae2 100644
--- a/tests/PHPUnit/Unit/NonceTest.php
+++ b/tests/PHPUnit/Unit/NonceTest.php
@@ -1,16 +1,20 @@
<?php
-use Piwik\Config;
-use Piwik\Nonce;
-
/**
* Piwik - free/libre analytics platform
*
- * @backupGlobals enabled
- *
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class NonceTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\Config;
+use Piwik\Nonce;
+
+/**
+ * @backupGlobals enabled
+ */
+class NonceTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for acceptable origins test
diff --git a/tests/PHPUnit/Unit/Period/DayTest.php b/tests/PHPUnit/Unit/Period/DayTest.php
index eb653fcc5c..ae1ba01844 100644
--- a/tests/PHPUnit/Unit/Period/DayTest.php
+++ b/tests/PHPUnit/Unit/Period/DayTest.php
@@ -5,14 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\Period;
+
use Piwik\Date;
use Piwik\Period\Day;
use Piwik\Translate;
-/**
- * Testing Period_Day
- */
-class Period_DayTest extends PHPUnit_Framework_TestCase
+class Period_DayTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
@@ -21,7 +21,7 @@ class Period_DayTest extends PHPUnit_Framework_TestCase
{
try {
new Day('Invalid Date');
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return;
}
$this->fail('Expected Exception not raised');
@@ -203,7 +203,7 @@ class Period_DayTest extends PHPUnit_Framework_TestCase
try {
$period->addSubperiod('');
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return;
}
// expected string
diff --git a/tests/PHPUnit/Unit/Period/MonthTest.php b/tests/PHPUnit/Unit/Period/MonthTest.php
index 5821aceee5..916f925e6d 100644
--- a/tests/PHPUnit/Unit/Period/MonthTest.php
+++ b/tests/PHPUnit/Unit/Period/MonthTest.php
@@ -5,14 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\Period;
+
use Piwik\Date;
use Piwik\Period\Month;
use Piwik\Translate;
-/**
- * Testing Period_Month
- */
-class Period_MonthTest extends PHPUnit_Framework_TestCase
+class Period_MonthTest extends \PHPUnit_Framework_TestCase
{
/**
* testing december
diff --git a/tests/PHPUnit/Unit/Period/RangeTest.php b/tests/PHPUnit/Unit/Period/RangeTest.php
index b2114a4372..7c92d2119f 100644
--- a/tests/PHPUnit/Unit/Period/RangeTest.php
+++ b/tests/PHPUnit/Unit/Period/RangeTest.php
@@ -5,6 +5,10 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\Period;
+
+use Exception;
use Piwik\Date;
use Piwik\Period\Month;
use Piwik\Period\Range;
@@ -12,10 +16,7 @@ use Piwik\Period\Week;
use Piwik\Period\Year;
use Piwik\Translate;
-/**
- * @group Core_Period_RangeTest
- */
-class Period_RangeTest extends PHPUnit_Framework_TestCase
+class Period_RangeTest extends \PHPUnit_Framework_TestCase
{
// test range 1
/**
diff --git a/tests/PHPUnit/Unit/Period/WeekTest.php b/tests/PHPUnit/Unit/Period/WeekTest.php
index 2994f8e13d..c543a2db5d 100644
--- a/tests/PHPUnit/Unit/Period/WeekTest.php
+++ b/tests/PHPUnit/Unit/Period/WeekTest.php
@@ -5,14 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\Period;
+
use Piwik\Date;
use Piwik\Period\Week;
use Piwik\Translate;
-/**
- * Testing Period_Week
- */
-class Period_WeekTest extends PHPUnit_Framework_TestCase
+class Period_WeekTest extends \PHPUnit_Framework_TestCase
{
/**
* test week between 2 years
diff --git a/tests/PHPUnit/Unit/Period/YearTest.php b/tests/PHPUnit/Unit/Period/YearTest.php
index ef28d619d6..fad41535de 100644
--- a/tests/PHPUnit/Unit/Period/YearTest.php
+++ b/tests/PHPUnit/Unit/Period/YearTest.php
@@ -5,14 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\Period;
+
use Piwik\Date;
use Piwik\Period\Year;
use Piwik\Translate;
-/**
- * Testing Period_Year
- */
-class Period_YearTest extends PHPUnit_Framework_TestCase
+class Period_YearTest extends \PHPUnit_Framework_TestCase
{
/**
* test normal case
diff --git a/tests/PHPUnit/Unit/PeriodTest.php b/tests/PHPUnit/Unit/PeriodTest.php
index 8888c4c763..bbae689f95 100644
--- a/tests/PHPUnit/Unit/PeriodTest.php
+++ b/tests/PHPUnit/Unit/PeriodTest.php
@@ -5,6 +5,9 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\Date;
use Piwik\Period\Day;
use Piwik\Period;
@@ -12,7 +15,7 @@ use Piwik\Period\Month;
use Piwik\Period\Week;
use Piwik\Period\Year;
-class PeriodTest extends PHPUnit_Framework_TestCase
+class PeriodTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
@@ -95,7 +98,7 @@ class PeriodTest extends PHPUnit_Framework_TestCase
{
try {
Period\Factory::build('inValid', Date::today());
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return;
}
$this->fail('Expected Exception not raised');
diff --git a/tests/PHPUnit/Unit/RankingQueryTest.php b/tests/PHPUnit/Unit/RankingQueryTest.php
index 7941c25d35..49c24e56be 100644
--- a/tests/PHPUnit/Unit/RankingQueryTest.php
+++ b/tests/PHPUnit/Unit/RankingQueryTest.php
@@ -6,11 +6,12 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit;
+
use Piwik\RankingQuery;
-class RankingQueryTest extends PHPUnit_Framework_TestCase
+class RankingQueryTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @group Core
*/
@@ -146,5 +147,4 @@ class RankingQueryTest extends PHPUnit_Framework_TestCase
$message = 'Unexpected query: ' . $query;
$this->assertEquals($queryNoWhitespace, $expectedNoWhitespace, $message);
}
-
}
diff --git a/tests/PHPUnit/Unit/RegistryTest.php b/tests/PHPUnit/Unit/RegistryTest.php
index c6c2aff894..376c857ed1 100644
--- a/tests/PHPUnit/Unit/RegistryTest.php
+++ b/tests/PHPUnit/Unit/RegistryTest.php
@@ -5,9 +5,12 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\Registry;
-class RegistryTest extends PHPUnit_Framework_TestCase
+class RegistryTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
diff --git a/tests/PHPUnit/Unit/ScheduledTaskTest.php b/tests/PHPUnit/Unit/ScheduledTaskTest.php
index 5a131521ff..1b67ddf6f2 100644
--- a/tests/PHPUnit/Unit/ScheduledTaskTest.php
+++ b/tests/PHPUnit/Unit/ScheduledTaskTest.php
@@ -5,19 +5,20 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\Plugins\ScheduledReports\ScheduledReports;
use Piwik\ScheduledTask;
-require_once PIWIK_INCLUDE_PATH . '/plugins/ScheduledReports/ScheduledReports.php';
-
-class ScheduledTaskTest extends PHPUnit_Framework_TestCase
+class ScheduledTaskTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
*/
public function testGetClassName()
{
- $scheduledTask = new ScheduledTask (new ScheduledReports(), null, null, null);
+ $scheduledTask = new ScheduledTask(new ScheduledReports(), null, null, null);
$this->assertEquals('Piwik\Plugins\ScheduledReports\ScheduledReports', $scheduledTask->getClassName());
}
@@ -43,5 +44,4 @@ class ScheduledTaskTest extends PHPUnit_Framework_TestCase
{
$this->assertEquals($expectedTaskName, ScheduledTask::getTaskName($className, $methodName, $methodParameter));
}
-
}
diff --git a/tests/PHPUnit/Unit/ScheduledTime/DailyTest.php b/tests/PHPUnit/Unit/ScheduledTime/DailyTest.php
index 1a62019392..55a6c08520 100644
--- a/tests/PHPUnit/Unit/ScheduledTime/DailyTest.php
+++ b/tests/PHPUnit/Unit/ScheduledTime/DailyTest.php
@@ -6,10 +6,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Unit\ScheduledTime;
+use Exception;
+use Piwik\ScheduledTime;
+
/**
* @group Core
*/
-class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
+class ScheduledTime_DailyTest extends \PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_00_00;
private static $_JANUARY_01_1971_09_10_00;
@@ -33,7 +37,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeDailyNegative()
{
try {
- $dailySchedule = \Piwik\ScheduledTime::factory('daily');
+ $dailySchedule = ScheduledTime::factory('daily');
$dailySchedule->setHour(-1);
} catch (Exception $e) {
@@ -48,7 +52,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeDailyOver24()
{
try {
- $dailySchedule = \Piwik\ScheduledTime::factory('daily');
+ $dailySchedule = ScheduledTime::factory('daily');
$dailySchedule->setHour(25);
} catch (Exception $e) {
return;
@@ -62,7 +66,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeDaily()
{
try {
- $dailySchedule = \Piwik\ScheduledTime::factory('daily');
+ $dailySchedule = ScheduledTime::factory('daily');
$dailySchedule->setDay(1);
} catch (Exception $e) {
return;
diff --git a/tests/PHPUnit/Unit/ScheduledTime/HourlyTest.php b/tests/PHPUnit/Unit/ScheduledTime/HourlyTest.php
index 14f4ce3c0e..4c71c1670a 100644
--- a/tests/PHPUnit/Unit/ScheduledTime/HourlyTest.php
+++ b/tests/PHPUnit/Unit/ScheduledTime/HourlyTest.php
@@ -5,9 +5,13 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime\Hourly;
-class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
+class ScheduledTime_HourlyTest extends \PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_00_00;
private static $_JANUARY_01_1971_09_10_00;
diff --git a/tests/PHPUnit/Unit/ScheduledTime/MonthlyTest.php b/tests/PHPUnit/Unit/ScheduledTime/MonthlyTest.php
index 17bde4ee6d..58ed51ab02 100644
--- a/tests/PHPUnit/Unit/ScheduledTime/MonthlyTest.php
+++ b/tests/PHPUnit/Unit/ScheduledTime/MonthlyTest.php
@@ -5,12 +5,15 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\ScheduledTime;
+
use Piwik\ScheduledTime\Monthly;
/**
* @group Core
*/
-class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
+class ScheduledTime_MonthlyTest extends \PHPUnit_Framework_TestCase
{
public static $_JANUARY_01_1971_09_00_00; // initialized below class definition
public static $_JANUARY_02_1971_09_00_00;
diff --git a/tests/PHPUnit/Unit/ScheduledTime/WeeklyTest.php b/tests/PHPUnit/Unit/ScheduledTime/WeeklyTest.php
index 62b6fce8ed..793d87f9e5 100644
--- a/tests/PHPUnit/Unit/ScheduledTime/WeeklyTest.php
+++ b/tests/PHPUnit/Unit/ScheduledTime/WeeklyTest.php
@@ -5,12 +5,16 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime\Weekly;
/**
* @group Core
*/
-class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
+class ScheduledTime_WeeklyTest extends \PHPUnit_Framework_TestCase
{
public static $_JANUARY_01_1971_09_10_00; // initialized below class declaration
public static $_JANUARY_04_1971_00_00_00;
diff --git a/tests/PHPUnit/Unit/SegmentExpressionTest.php b/tests/PHPUnit/Unit/SegmentExpressionTest.php
index 874df9e2d1..aadecc8f0e 100644
--- a/tests/PHPUnit/Unit/SegmentExpressionTest.php
+++ b/tests/PHPUnit/Unit/SegmentExpressionTest.php
@@ -5,9 +5,12 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\SegmentExpression;
-class SegmentExpressionTest extends PHPUnit_Framework_TestCase
+class SegmentExpressionTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testSegmentSqlSimpleNoOperation
@@ -121,7 +124,7 @@ class SegmentExpressionTest extends PHPUnit_Framework_TestCase
$segment = new SegmentExpression($bogus);
$segment->parseSubExpressions();
$segment->getSql();
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return;
}
$this->fail('Expected exception not raised for:' . var_export($segment->getSql(), true));
diff --git a/tests/PHPUnit/Unit/TaskSchedulerTest.php b/tests/PHPUnit/Unit/TaskSchedulerTest.php
index 70ec2f2ef4..762ae44de5 100644
--- a/tests/PHPUnit/Unit/TaskSchedulerTest.php
+++ b/tests/PHPUnit/Unit/TaskSchedulerTest.php
@@ -5,13 +5,20 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Unit;
+
use Piwik\EventDispatcher;
+use Piwik\Piwik;
+use Piwik\Plugin;
use Piwik\ScheduledTask;
use Piwik\ScheduledTaskTimetable;
use Piwik\TaskScheduler;
use Piwik\Tests\Framework\Mock\PiwikOption;
+use ReflectionMethod;
+use ReflectionProperty;
-class TaskSchedulerTest extends PHPUnit_Framework_TestCase
+class TaskSchedulerTest extends \PHPUnit_Framework_TestCase
{
private static function getTestTimetable()
{
@@ -195,13 +202,13 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
$scheduledTaskThree = new ScheduledTask ($this, 'scheduledTaskThree', null, $dailySchedule);
$caseOneExpectedTable = array(
- 'TaskSchedulerTest.scheduledTaskOne' => $scheduledTaskOne->getRescheduledTime(),
- 'TaskSchedulerTest.scheduledTaskTwo_1' => $systemTime + 60000,
- 'TaskSchedulerTest.scheduledTaskThree' => $scheduledTaskThree->getRescheduledTime(),
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskOne' => $scheduledTaskOne->getRescheduledTime(),
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskTwo_1' => $systemTime + 60000,
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskThree' => $scheduledTaskThree->getRescheduledTime(),
);
$caseTwoTimetableBeforeExecution = $caseOneExpectedTable;
- $caseTwoTimetableBeforeExecution['TaskSchedulerTest.scheduledTaskThree'] = $systemTime; // simulate elapsed time between case 1 and 2
+ $caseTwoTimetableBeforeExecution['Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskThree'] = $systemTime; // simulate elapsed time between case 1 and 2
return array(
@@ -214,13 +221,13 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
// methods that should be executed
array(
- 'TaskSchedulerTest.scheduledTaskOne'
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskOne'
),
// timetable before task execution
array(
- 'TaskSchedulerTest.scheduledTaskOne' => $systemTime,
- 'TaskSchedulerTest.scheduledTaskTwo_1' => $systemTime + 60000,
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskOne' => $systemTime,
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskTwo_1' => $systemTime + 60000,
),
// configured tasks
array(
@@ -237,13 +244,13 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
array(
// expected timetable
array(
- 'TaskSchedulerTest.scheduledTaskOne' => $scheduledTaskOne->getRescheduledTime(),
- 'TaskSchedulerTest.scheduledTaskThree' => $scheduledTaskThree->getRescheduledTime()
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskOne' => $scheduledTaskOne->getRescheduledTime(),
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskThree' => $scheduledTaskThree->getRescheduledTime()
),
// methods that should be executed
array(
- 'TaskSchedulerTest.scheduledTaskThree'
+ 'Piwik\Tests\Unit\TaskSchedulerTest.scheduledTaskThree'
),
// timetable before task execution
@@ -277,13 +284,13 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
public function testRunTasks($expectedTimetable, $expectedExecutedTasks, $timetableBeforeTaskExecution, $configuredTasks)
{
// temporarily unload plugins
- $plugins = \Piwik\Plugin\Manager::getInstance()->getLoadedPlugins();
- $plugins = array_map(function ($p) { return $p->getPluginName(); }, $plugins);
+ $plugins = Plugin\Manager::getInstance()->getLoadedPlugins();
+ $plugins = array_map(function (Plugin $p) { return $p->getPluginName(); }, $plugins);
- \Piwik\Plugin\Manager::getInstance()->unloadPlugins();
+ Plugin\Manager::getInstance()->unloadPlugins();
// make sure the get tasks event returns our configured tasks
- \Piwik\Piwik::addAction(TaskScheduler::GET_TASKS_EVENT, function(&$tasks) use($configuredTasks) {
+ Piwik::addAction(TaskScheduler::GET_TASKS_EVENT, function(&$tasks) use($configuredTasks) {
$tasks = $configuredTasks;
});
@@ -308,7 +315,7 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
// restore loaded plugins & piwik options
EventDispatcher::getInstance()->clearObservers(TaskScheduler::GET_TASKS_EVENT);
- \Piwik\Plugin\Manager::getInstance()->loadPlugins($plugins);
+ Plugin\Manager::getInstance()->loadPlugins($plugins);
self::resetPiwikOption();
}
diff --git a/tests/PHPUnit/Unit/Translate/Filter/ByBaseTranslationsTest.php b/tests/PHPUnit/Unit/Translate/Filter/ByBaseTranslationsTest.php
index 8ca2f09319..5cec2c7ca7 100644
--- a/tests/PHPUnit/Unit/Translate/Filter/ByBaseTranslationsTest.php
+++ b/tests/PHPUnit/Unit/Translate/Filter/ByBaseTranslationsTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Filter\ByBaseTranslations;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class ByBaseTranslationsTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Filter;
+
+use Piwik\Translate\Filter\ByBaseTranslations;
+
+class ByBaseTranslationsTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestData()
{
diff --git a/tests/PHPUnit/Unit/Translate/Filter/ByParameterCountTest.php b/tests/PHPUnit/Unit/Translate/Filter/ByParameterCountTest.php
index 06c72ed24f..220e90f9a6 100644
--- a/tests/PHPUnit/Unit/Translate/Filter/ByParameterCountTest.php
+++ b/tests/PHPUnit/Unit/Translate/Filter/ByParameterCountTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Filter\ByParameterCount;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class ByParameterCountTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Filter;
+
+use Piwik\Translate\Filter\ByParameterCount;
+
+class ByParameterCountTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestData()
{
diff --git a/tests/PHPUnit/Unit/Translate/Filter/EmptyTranslationsTest.php b/tests/PHPUnit/Unit/Translate/Filter/EmptyTranslationsTest.php
index a083e50a43..47ec5348db 100644
--- a/tests/PHPUnit/Unit/Translate/Filter/EmptyTranslationsTest.php
+++ b/tests/PHPUnit/Unit/Translate/Filter/EmptyTranslationsTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Filter\EmptyTranslations;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class EmptyTranslationsTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Filter;
+
+use Piwik\Translate\Filter\EmptyTranslations;
+
+class EmptyTranslationsTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestData()
{
diff --git a/tests/PHPUnit/Unit/Translate/Filter/EncodedEntitiesTest.php b/tests/PHPUnit/Unit/Translate/Filter/EncodedEntitiesTest.php
index cfad46387b..19ceb5f784 100644
--- a/tests/PHPUnit/Unit/Translate/Filter/EncodedEntitiesTest.php
+++ b/tests/PHPUnit/Unit/Translate/Filter/EncodedEntitiesTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Filter\EncodedEntities;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class EncodedEntitiesTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Filter;
+
+use Piwik\Translate\Filter\EncodedEntities;
+
+class EncodedEntitiesTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestData()
{
diff --git a/tests/PHPUnit/Unit/Translate/Filter/UnnecassaryWhitespacesTest.php b/tests/PHPUnit/Unit/Translate/Filter/UnnecassaryWhitespacesTest.php
index 3f86b97a0d..77cecf7e77 100644
--- a/tests/PHPUnit/Unit/Translate/Filter/UnnecassaryWhitespacesTest.php
+++ b/tests/PHPUnit/Unit/Translate/Filter/UnnecassaryWhitespacesTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Filter\UnnecassaryWhitespaces;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class UnnecassaryWhitepsacesTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Filter;
+
+use Piwik\Translate\Filter\UnnecassaryWhitespaces;
+
+class UnnecassaryWhitepsacesTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestData()
{
diff --git a/tests/PHPUnit/Unit/Translate/Validate/CoreTranslationsTest.php b/tests/PHPUnit/Unit/Translate/Validate/CoreTranslationsTest.php
index 3cde1e42c8..258267fd3e 100644
--- a/tests/PHPUnit/Unit/Translate/Validate/CoreTranslationsTest.php
+++ b/tests/PHPUnit/Unit/Translate/Validate/CoreTranslationsTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Validate\CoreTranslations;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class CoreTranslationsTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Validate;
+
+use Piwik\Translate\Validate\CoreTranslations;
+
+class CoreTranslationsTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/PHPUnit/Unit/Translate/Validate/NoScriptsTest.php b/tests/PHPUnit/Unit/Translate/Validate/NoScriptsTest.php
index e0a8f27b80..519126708d 100644
--- a/tests/PHPUnit/Unit/Translate/Validate/NoScriptsTest.php
+++ b/tests/PHPUnit/Unit/Translate/Validate/NoScriptsTest.php
@@ -1,13 +1,16 @@
<?php
-use Piwik\Translate\Validate\NoScripts;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class NoScriptsTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit\Translate\Validate;
+
+use Piwik\Translate\Validate\NoScripts;
+
+class NoScriptsTest extends \PHPUnit_Framework_TestCase
{
public function getFilterTestDataValid()
{
diff --git a/tests/PHPUnit/Unit/Translate/WriterTest.php b/tests/PHPUnit/Unit/Translate/WriterTest.php
index 500009941a..66e1efe30a 100644
--- a/tests/PHPUnit/Unit/Translate/WriterTest.php
+++ b/tests/PHPUnit/Unit/Translate/WriterTest.php
@@ -1,4 +1,12 @@
<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Unit\Translate;
use Piwik\Translate\Filter\ByBaseTranslations;
use Piwik\Translate\Filter\ByParameterCount;
@@ -7,13 +15,7 @@ use Piwik\Translate\Validate\CoreTranslations;
use Piwik\Translate\Validate\NoScripts;
use Piwik\Translate\Writer;
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-class WriterTest extends PHPUnit_Framework_TestCase
+class WriterTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
@@ -46,7 +48,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
/**
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
*/
public function testConstructorInvalid()
{
@@ -126,7 +128,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
/**
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
*/
public function testSaveException()
{
@@ -137,7 +139,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
/**
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
*/
public function testSaveTemporaryException()
{
@@ -249,7 +251,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
/**
* @group Core
*
- * @expectedException Exception
+ * @expectedException \Exception
* @dataProvider getInvalidLanguages
*/
public function testSetLanguageInvalid($language)
diff --git a/tests/PHPUnit/Unit/TranslateTest.php b/tests/PHPUnit/Unit/TranslateTest.php
index b7a99f70ee..a26c9c3713 100644
--- a/tests/PHPUnit/Unit/TranslateTest.php
+++ b/tests/PHPUnit/Unit/TranslateTest.php
@@ -1,14 +1,16 @@
<?php
-
-use Piwik\Translate;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class TranslateTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\Translate;
+
+class TranslateTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testClean
diff --git a/tests/PHPUnit/Unit/UrlHelperTest.php b/tests/PHPUnit/Unit/UrlHelperTest.php
index 79ba4fbecd..9a006c7a40 100644
--- a/tests/PHPUnit/Unit/UrlHelperTest.php
+++ b/tests/PHPUnit/Unit/UrlHelperTest.php
@@ -1,13 +1,17 @@
<?php
-use Piwik\UrlHelper;
-
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class Core_UrlHelperTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\UrlHelper;
+use Spyc;
+
+class Core_UrlHelperTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testIsUrl
@@ -176,13 +180,13 @@ class Core_UrlHelperTest extends PHPUnit_Framework_TestCase
{
$this->assertEquals($expected, UrlHelper::getLossyUrl($input));
}
-
+
private function includeDataFilesForSearchEngineTest()
{
include "DataFiles/SearchEngines.php";
include "DataFiles/Countries.php";
}
-
+
/**
* @group Core
*/
diff --git a/tests/PHPUnit/Unit/UrlTest.php b/tests/PHPUnit/Unit/UrlTest.php
index 3c2bafe73e..9ad2571be6 100644
--- a/tests/PHPUnit/Unit/UrlTest.php
+++ b/tests/PHPUnit/Unit/UrlTest.php
@@ -1,16 +1,20 @@
<?php
-use Piwik\Config;
-use Piwik\Url;
-
/**
* Piwik - free/libre analytics platform
*
- * @backupGlobals enabled
- *
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-class UrlTest extends PHPUnit_Framework_TestCase
+
+namespace Piwik\Tests\Unit;
+
+use Piwik\Config;
+use Piwik\Url;
+
+/**
+ * @backupGlobals enabled
+ */
+class UrlTest extends \PHPUnit_Framework_TestCase
{
/**
* @group Core
diff --git a/tests/lib/screenshot-testing/support/chai-extras.js b/tests/lib/screenshot-testing/support/chai-extras.js
index 1a65b718fa..6b12de1998 100644
--- a/tests/lib/screenshot-testing/support/chai-extras.js
+++ b/tests/lib/screenshot-testing/support/chai-extras.js
@@ -139,7 +139,7 @@ function capture(screenName, compareAgainst, selector, pageSetupFn, done) {
// if the files are not exact, perform a diff to check if they are truly different
resemble("file://" + processedScreenshotPath).compareTo("file://" + expectedScreenshotPath).onComplete(function(data) {
if (data.misMatchPercentage != 0) {
- fail("Processed screenshot does not match expected for " + screenshotFileName + ".");
+ fail("Processed screenshot does not match expected for " + screenshotFileName + ". (mismatch = " + data.misMatchPercentage + ")");
return;
}