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:
-rw-r--r--tests/PHPUnit/Integration/AccessTest.php28
-rw-r--r--tests/PHPUnit/Integration/ArchiveProcessingTest.php29
-rw-r--r--tests/PHPUnit/Integration/AssetManager/UIAssetMinifierTest.php6
-rw-r--r--tests/PHPUnit/Integration/CronArchive/FixedSiteIdsTest.php7
-rw-r--r--tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php5
-rw-r--r--tests/PHPUnit/Integration/DataAccess/ModelTest.php7
-rw-r--r--tests/PHPUnit/Integration/DbTest.php11
-rw-r--r--tests/PHPUnit/Integration/DocumentationGeneratorTest.php (renamed from tests/PHPUnit/Core/API/DocumentationGeneratorTest.php)13
-rw-r--r--tests/PHPUnit/Integration/HttpTest.php17
-rw-r--r--tests/PHPUnit/Integration/JsProxyTest.php22
-rw-r--r--tests/PHPUnit/Integration/LogTest.php32
-rw-r--r--tests/PHPUnit/Integration/OptionTest.php25
-rw-r--r--tests/PHPUnit/Integration/PiwikTest.php7
-rw-r--r--tests/PHPUnit/Integration/Plugin/SettingsTest.php10
-rw-r--r--tests/PHPUnit/Integration/ReleaseCheckListTest.php68
-rw-r--r--tests/PHPUnit/Integration/ReportTest.php6
-rw-r--r--tests/PHPUnit/Integration/SegmentTest.php39
-rw-r--r--tests/PHPUnit/Integration/ServeStaticFileTest.php7
-rwxr-xr-xtests/PHPUnit/Integration/SqlTest.php17
-rw-r--r--tests/PHPUnit/Integration/Tracker/ActionTest.php16
-rw-r--r--tests/PHPUnit/Integration/Tracker/DbTest.php11
-rw-r--r--tests/PHPUnit/Integration/Tracker/Visit2Test.php27
-rw-r--r--tests/PHPUnit/Integration/Tracker/VisitTest.php15
-rw-r--r--tests/PHPUnit/Integration/TrackerTest.php2
-rw-r--r--tests/PHPUnit/Integration/TravisEnvironmentTest.php22
-rw-r--r--tests/PHPUnit/Integration/UpdaterTest.php7
-rw-r--r--tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php8
-rw-r--r--tests/PHPUnit/Integration/WidgetsListTest.php23
-rw-r--r--tests/resources/TestPluginLogClass.php3
29 files changed, 189 insertions, 301 deletions
diff --git a/tests/PHPUnit/Integration/AccessTest.php b/tests/PHPUnit/Integration/AccessTest.php
index 94143fff5e..9ccf69b11b 100644
--- a/tests/PHPUnit/Integration/AccessTest.php
+++ b/tests/PHPUnit/Integration/AccessTest.php
@@ -5,16 +5,18 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
+use Exception;
use Piwik\Access;
use Piwik\AuthResult;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_AccessTest
- *
* @group Core
*/
-class Core_AccessTest extends IntegrationTestCase
+class AccessTest extends IntegrationTestCase
{
public function setUp()
{
@@ -88,7 +90,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasSuperUserAccessWithEmptyAccess()
{
@@ -104,7 +106,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasSomeAdminAccessWithEmptyAccess()
{
@@ -134,7 +136,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasSomeViewAccessWithEmptyAccess()
{
@@ -164,7 +166,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasViewAccessWithEmptyAccessNoSiteIdsGiven()
{
@@ -208,7 +210,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasViewAccessWithSomeAccessFailure()
{
@@ -232,7 +234,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasAdminAccessWithEmptyAccessNoSiteIdsGiven()
{
@@ -273,7 +275,7 @@ class Core_AccessTest extends IntegrationTestCase
}
/**
- * @expectedException Piwik\NoAccessException
+ * @expectedException \Piwik\NoAccessException
*/
public function testCheckUserHasAdminAccessWithSomeAccessFailure()
{
@@ -304,8 +306,8 @@ class Core_AccessTest extends IntegrationTestCase
public function testReloadAccessWithMockedAuthValid()
{
- $mock = $this->getMock('\\Piwik\\Auth', array('authenticate', 'getName', 'getTokenAuthSecret', 'getLogin', 'setTokenAuth', 'setLogin',
- 'setPassword', 'setPasswordHash'));
+ $mock = $this->getMock('Piwik\\Auth', array('authenticate', 'getName', 'getTokenAuthSecret', 'getLogin', 'setTokenAuth', 'setLogin',
+ 'setPassword', 'setPasswordHash'));
$mock->expects($this->once())
->method('authenticate')
->will($this->returnValue(new AuthResult(AuthResult::SUCCESS, 'login', 'token')));
@@ -370,4 +372,4 @@ class Core_AccessTest extends IntegrationTestCase
Core_AccessTest::assertTrue($access->hasSuperUserAccess());
});
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/ArchiveProcessingTest.php b/tests/PHPUnit/Integration/ArchiveProcessingTest.php
index 6514a10134..7c9f24e096 100644
--- a/tests/PHPUnit/Integration/ArchiveProcessingTest.php
+++ b/tests/PHPUnit/Integration/ArchiveProcessingTest.php
@@ -6,6 +6,9 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration;
+
+use Exception;
use Piwik\Access;
use Piwik\ArchiveProcessor;
use Piwik\ArchiveProcessor\Rules;
@@ -20,18 +23,21 @@ use Piwik\Plugins\SitesManager\API;
use Piwik\Segment;
use Piwik\SettingsServer;
use Piwik\Site;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
-class Core_ArchiveProcessorTest extends ArchiveProcessor\Loader {
-
+class ArchiveProcessorTest extends ArchiveProcessor\Loader
+{
public function getParams()
{
return $this->params;
}
+
public function public_getMinTimeArchiveProcessed()
{
return $this->getMinTimeArchiveProcessed();
}
+
public function public_isArchiveTemporary()
{
return $this->isArchiveTemporary();
@@ -39,11 +45,9 @@ class Core_ArchiveProcessorTest extends ArchiveProcessor\Loader {
}
/**
- * Class Core_ArchiveProcessorTest
- *
* @group Core
*/
-class Core_ArchiveProcessingTest extends IntegrationTestCase
+class ArchiveProcessingTest extends IntegrationTestCase
{
public function setUp()
{
@@ -90,7 +94,7 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
* @param string $periodLabel
* @param string $dateLabel
* @param string $siteTimezone
- * @return \Core_ArchiveProcessorTest
+ * @return ArchiveProcessorTest
*/
private function _createArchiveProcessor($periodLabel, $dateLabel, $siteTimezone)
{
@@ -100,12 +104,11 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
$segment = new Segment('', $site->getId());
$params = new ArchiveProcessor\Parameters($site, $period, $segment);
- return new \Core_ArchiveProcessorTest($params);
+ return new ArchiveProcessorTest($params);
}
/**
* test of validity of an archive, for a month not finished
- * @group Core
*/
public function testInitCurrentMonth()
{
@@ -138,7 +141,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for a month in the past
- * @group Core
*/
public function testInitDayInPast()
{
@@ -155,7 +157,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for a non UTC date in the past
- * @group Core
*/
public function testInitDayInPastNonUTCWebsite()
{
@@ -172,7 +173,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for a non UTC month in the past
- * @group Core
*/
public function testInitMonthInPastNonUTCWebsite()
{
@@ -189,7 +189,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for today's archive
- * @group Core
*/
public function testInitToday()
{
@@ -222,7 +221,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for today's archive with european timezone
- * @group Core
*/
public function testInitTodayEurope()
{
@@ -263,7 +261,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* test of validity of an archive, for today's archive with toronto's timezone
- * @group Core
*/
public function testInitTodayToronto()
{
@@ -303,7 +300,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* Testing batch insert
- * @group Core
*/
public function testTableInsertBatch()
{
@@ -351,7 +347,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* Testing plain inserts
- * @group Core
*/
public function testTableInsertBatchIterate()
{
@@ -374,7 +369,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* Testing batch insert (BLOB)
- * @group Core
*/
public function testTableInsertBatchBlob()
{
@@ -405,7 +399,6 @@ class Core_ArchiveProcessingTest extends IntegrationTestCase
/**
* Testing plain inserts (BLOB)
- * @group Core
*/
public function testTableInsertBatchIterateBlob()
{
diff --git a/tests/PHPUnit/Integration/AssetManager/UIAssetMinifierTest.php b/tests/PHPUnit/Integration/AssetManager/UIAssetMinifierTest.php
index 968c68c35f..e1dc6c4a3c 100644
--- a/tests/PHPUnit/Integration/AssetManager/UIAssetMinifierTest.php
+++ b/tests/PHPUnit/Integration/AssetManager/UIAssetMinifierTest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Piwik - free/libre analytics platform
*
@@ -7,12 +6,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\AssetManager;
+
use Piwik\AssetManager\UIAsset\OnDiskUIAsset;
use Piwik\AssetManager\UIAssetMinifier;
-class Piwik_Test_UIAssetMinifierTest extends PHPUnit_Framework_TestCase
+class UIAssetMinifierTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @var UIAssetMinifier
*/
diff --git a/tests/PHPUnit/Integration/CronArchive/FixedSiteIdsTest.php b/tests/PHPUnit/Integration/CronArchive/FixedSiteIdsTest.php
index 259df6fc9e..3f74af2bec 100644
--- a/tests/PHPUnit/Integration/CronArchive/FixedSiteIdsTest.php
+++ b/tests/PHPUnit/Integration/CronArchive/FixedSiteIdsTest.php
@@ -6,12 +6,14 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\CronArchive;
+
use Piwik\CronArchive\FixedSiteIds;
/**
* @group Core
*/
-class FixedSiteIdsTest extends PHPUnit_Framework_TestCase
+class FixedSiteIdsTest extends \PHPUnit_Framework_TestCase
{
/**
* @var FixedSiteIds
@@ -50,5 +52,4 @@ class FixedSiteIdsTest extends PHPUnit_Framework_TestCase
$this->assertNull($this->fixedSiteIds->getNextSiteId());
$this->assertEquals(4, $this->fixedSiteIds->getNumProcessedWebsites());
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php
index 43962ff17b..6e3959ceda 100644
--- a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php
+++ b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration;
+
use Piwik\CronArchive\SharedSiteIds;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
@@ -111,5 +113,4 @@ class SharedSiteIdsTest extends IntegrationTestCase
$this->assertEquals(4, $this->sharedSiteIds->getNumProcessedWebsites());
$this->assertEquals(array(), $this->sharedSiteIds->getAllSiteIdsToArchive());
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/DataAccess/ModelTest.php b/tests/PHPUnit/Integration/DataAccess/ModelTest.php
index 270253b82a..1ec10bdebf 100644
--- a/tests/PHPUnit/Integration/DataAccess/ModelTest.php
+++ b/tests/PHPUnit/Integration/DataAccess/ModelTest.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\DataAccess;
+
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\DataAccess\Model;
@@ -13,7 +15,7 @@ use Piwik\DataAccess\Model;
* @group Core
* @group DataAccess
*/
-class Core_DataAccess_ModelTest extends IntegrationTestCase
+class ModelTest extends IntegrationTestCase
{
/**
* @var Model
@@ -45,5 +47,4 @@ class Core_DataAccess_ModelTest extends IntegrationTestCase
$this->assertEquals($expectedId, $id);
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php
index c7a8e465eb..e450ec7bae 100644
--- a/tests/PHPUnit/Integration/DbTest.php
+++ b/tests/PHPUnit/Integration/DbTest.php
@@ -5,18 +5,18 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
use Piwik\Common;
use Piwik\Db;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_DbTest
- *
* @group Core
*/
-class Core_DbTest extends IntegrationTestCase
+class DbTest extends IntegrationTestCase
{
-
public function test_getColumnNamesFromTable()
{
$this->assertColumnNames('access', array('login', 'idsite', 'access'));
@@ -29,5 +29,4 @@ class Core_DbTest extends IntegrationTestCase
$this->assertEquals($expectedColumnNames, $colmuns);
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Core/API/DocumentationGeneratorTest.php b/tests/PHPUnit/Integration/DocumentationGeneratorTest.php
index 5fb119f6a0..253844cd18 100644
--- a/tests/PHPUnit/Core/API/DocumentationGeneratorTest.php
+++ b/tests/PHPUnit/Integration/DocumentationGeneratorTest.php
@@ -1,16 +1,17 @@
<?php
/**
- * Copyright (C) Piwik PRO - All rights reserved.
+ * Piwik - free/libre analytics platform
*
- * Using this code requires that you first get a license from Piwik PRO.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
- *
- * @link http://piwik.pro
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
+use PHPUnit_Framework_TestCase;
use Piwik\API\DocumentationGenerator;
use Piwik\API\Proxy;
use Piwik\EventDispatcher;
-use Piwik\Plugin\Manager as PluginManager;
/**
* @group Core
diff --git a/tests/PHPUnit/Integration/HttpTest.php b/tests/PHPUnit/Integration/HttpTest.php
index 68988d78a9..a5d62b3060 100644
--- a/tests/PHPUnit/Integration/HttpTest.php
+++ b/tests/PHPUnit/Integration/HttpTest.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\Integration;
+
use Piwik\Http;
use Piwik\Tests\Framework\Fixture;
/**
+ * @group Core
* @group HttpTest
*/
-class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
+class HttpTest extends \PHPUnit_Framework_TestCase
{
/**
* Dataprovider for testFetchRemoteFile
@@ -26,8 +30,6 @@ class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
}
/**
- * @group Core
- *
* @dataProvider getMethodsToTest
*/
public function testFetchRemoteFile($method)
@@ -37,9 +39,6 @@ class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
$this->assertTrue(strpos($result, 'Piwik') !== false);
}
- /**
- * @group Core
- */
public function testFetchApiLatestVersion()
{
$destinationPath = PIWIK_USER_PATH . '/tmp/latest/LATEST';
@@ -48,9 +47,6 @@ class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
$this->assertGreaterThan(0, filesize($destinationPath));
}
- /**
- * @group Core
- */
public function testFetchLatestZip()
{
$destinationPath = PIWIK_USER_PATH . '/tmp/latest/latest.zip';
@@ -60,7 +56,6 @@ class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
}
/**
- * @group Core
* @dataProvider getMethodsToTest
*/
public function testCustomByteRange($method)
@@ -88,8 +83,6 @@ class Piwik_Test_HttpTest extends PHPUnit_Framework_TestCase
}
/**
- * @group Core
- *
* @dataProvider getMethodsToTest
*/
public function testHEADOperation($method)
diff --git a/tests/PHPUnit/Integration/JsProxyTest.php b/tests/PHPUnit/Integration/JsProxyTest.php
index 92a6461acc..e968fec50e 100644
--- a/tests/PHPUnit/Integration/JsProxyTest.php
+++ b/tests/PHPUnit/Integration/JsProxyTest.php
@@ -6,14 +6,16 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration;
+
use Piwik\Tests\Framework\Fixture;
-class Test_Piwik_JsProxy extends PHPUnit_Framework_TestCase
+/**
+ * @group Core
+ */
+class JsProxyTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @group Core
- */
- function testPiwikJs()
+ public function testPiwikJs()
{
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $this->getStaticSrvUrl() . '/js/');
@@ -28,10 +30,7 @@ class Test_Piwik_JsProxy extends PHPUnit_Framework_TestCase
$this->assertEquals($piwik_js, $fullResponse, 'script content');
}
- /**
- * @group Core
- */
- function testPiwikJsNoComment()
+ public function testPiwikJsNoComment()
{
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $this->getStaticSrvUrl() . '/js/tracker.php');
@@ -47,10 +46,7 @@ class Test_Piwik_JsProxy extends PHPUnit_Framework_TestCase
$this->assertEquals($piwikNoCommentJs, $fullResponse, 'script content (if comment shows, $byteStart value in /js/tracker.php)');
}
- /**
- * @group Core
- */
- function testPiwikPhp()
+ public function testPiwikPhp()
{
$curlHandle = curl_init();
$url = $this->getStaticSrvUrl() . '/js/?idsite=1';
diff --git a/tests/PHPUnit/Integration/LogTest.php b/tests/PHPUnit/Integration/LogTest.php
index 8934e31e85..0e61fa00ff 100644
--- a/tests/PHPUnit/Integration/LogTest.php
+++ b/tests/PHPUnit/Integration/LogTest.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\Integration;
+
+use Exception;
use Piwik\Common;
use Piwik\Config;
use Piwik\Db;
@@ -17,12 +21,10 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
require_once PIWIK_INCLUDE_PATH . '/tests/resources/TestPluginLogClass.php';
/**
- * Class Core_LogTest
- *
* @group Core
* @group Core_LogTest
*/
-class Core_LogTest extends IntegrationTestCase
+class LogTest extends IntegrationTestCase
{
const TESTMESSAGE = 'test%smessage';
const STRING_MESSAGE_FORMAT = '[%tag%] %message%';
@@ -101,8 +103,6 @@ dummy backtrace'
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLoggingWorksWhenMessageIsString($backend)
@@ -114,12 +114,10 @@ dummy backtrace'
$this->screenOutput = ob_get_contents();
ob_end_clean();
- $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = 'Core_LogTest');
+ $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = __CLASS__);
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLoggingWorksWhenMessageIsSprintfString($backend)
@@ -131,12 +129,10 @@ dummy backtrace'
$this->screenOutput = ob_get_contents();
ob_end_clean();
- $this->checkBackend($backend, sprintf(self::TESTMESSAGE, " subst "), $formatMessage = true, $tag = 'Core_LogTest');
+ $this->checkBackend($backend, sprintf(self::TESTMESSAGE, " subst "), $formatMessage = true, $tag = __CLASS__);
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLoggingWorksWhenMessageIsError($backend)
@@ -149,13 +145,11 @@ dummy backtrace'
$this->screenOutput = ob_get_contents();
ob_end_clean();
- $this->checkBackend($backend, self::$expectedErrorOutput[$backend], $formatMessage = false, $tag = 'Core_LogTest');
+ $this->checkBackend($backend, self::$expectedErrorOutput[$backend], $formatMessage = false, $tag = __CLASS__);
$this->checkBackend('screen', self::$expectedErrorOutput['screen']); // errors should always written to the screen
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLoggingWorksWhenMessageIsException($backend)
@@ -168,13 +162,11 @@ dummy backtrace'
$this->screenOutput = ob_get_contents();
ob_end_clean();
- $this->checkBackend($backend, self::$expectedExceptionOutput[$backend], $formatMessage = false, $tag = 'Core_LogTest');
+ $this->checkBackend($backend, self::$expectedExceptionOutput[$backend], $formatMessage = false, $tag = __CLASS__);
$this->checkBackend('screen', self::$expectedExceptionOutput['screen']); // errors should always written to the screen
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLoggingCorrectlyIdentifiesPlugin($backend)
@@ -190,8 +182,6 @@ dummy backtrace'
}
/**
- * @group Core
- *
* @dataProvider getBackendsToTest
*/
public function testLogMessagesIgnoredWhenNotWithinLevel($backend)
@@ -208,7 +198,6 @@ dummy backtrace'
}
/**
- * @group Core
* @dataProvider getBackendsToTest
*/
public function testLogMessagesAreTrimmed($backend)
@@ -300,5 +289,4 @@ dummy backtrace'
$path = PIWIK_INCLUDE_PATH . '/tmp/logs/piwik.test.log';
return $path;
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/OptionTest.php b/tests/PHPUnit/Integration/OptionTest.php
index 0e6b8cba7d..616202f05f 100644
--- a/tests/PHPUnit/Integration/OptionTest.php
+++ b/tests/PHPUnit/Integration/OptionTest.php
@@ -5,22 +5,20 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
use Piwik\Common;
use Piwik\Db;
use Piwik\Option;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_OptionTest
- *
* @group Core
* @group Core_OptionTest
*/
-class Core_OptionTest extends IntegrationTestCase
+class OptionTest extends IntegrationTestCase
{
- /**
- * @group Core
- */
public function testGet()
{
// empty table, expect false (i.e., not found)
@@ -39,9 +37,6 @@ class Core_OptionTest extends IntegrationTestCase
$this->assertFalse(Option::get('anonymous_defaultReport'));
}
- /**
- * @group Core
- */
public function testGetOption()
{
// empty table, expect false (i.e., not found)
@@ -60,9 +55,6 @@ class Core_OptionTest extends IntegrationTestCase
$this->assertFalse(Option::get('anonymous_defaultReport'));
}
- /**
- * @group Core
- */
public function testSet()
{
// empty table, expect false (i.e., not found)
@@ -73,9 +65,6 @@ class Core_OptionTest extends IntegrationTestCase
$this->assertSame('1', Option::get('anonymous_defaultReport'));
}
- /**
- * @group Core
- */
public function testSetOption()
{
// empty table, expect false (i.e., not found)
@@ -86,9 +75,6 @@ class Core_OptionTest extends IntegrationTestCase
$this->assertSame('1', Option::get('anonymous_defaultReport'));
}
- /**
- * @group Core
- */
public function testDelete()
{
// empty table, expect false (i.e., not found)
@@ -121,9 +107,6 @@ class Core_OptionTest extends IntegrationTestCase
$this->assertFalse(Option::get('admin_defaultReport'));
}
- /**
- * @group Core
- */
public function testDeleteLike()
{
// empty table, expect false (i.e., not found)
diff --git a/tests/PHPUnit/Integration/PiwikTest.php b/tests/PHPUnit/Integration/PiwikTest.php
index 46cc79f0d2..252c08cd78 100644
--- a/tests/PHPUnit/Integration/PiwikTest.php
+++ b/tests/PHPUnit/Integration/PiwikTest.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\Integration;
+
use Piwik\Access;
use Piwik\Filesystem;
use Piwik\MetricsFormatter;
@@ -14,11 +17,9 @@ use Piwik\Translate;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_PiwikTest
- *
* @group Core
*/
-class Core_PiwikTest extends IntegrationTestCase
+class PiwikTest extends IntegrationTestCase
{
/**
* Dataprovider for testIsNumericValid
diff --git a/tests/PHPUnit/Integration/Plugin/SettingsTest.php b/tests/PHPUnit/Integration/Plugin/SettingsTest.php
index ffec54ce58..763ce4f09a 100644
--- a/tests/PHPUnit/Integration/Plugin/SettingsTest.php
+++ b/tests/PHPUnit/Integration/Plugin/SettingsTest.php
@@ -6,9 +6,12 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\Plugin;
+
use Piwik\Access;
use Piwik\Plugin\Settings as PluginSettings;
use Piwik\Settings\Setting;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
class CorePluginSettingsTest extends \Piwik\Plugins\ExampleSettingsPlugin\Settings {
@@ -25,11 +28,10 @@ class CorePluginSettingsTest extends \Piwik\Plugins\ExampleSettingsPlugin\Settin
}
/**
- * Class Core_Plugin_SettingsTest
* @group Core
* @group PluginSettings
*/
-class Core_Plugin_SettingsTest extends IntegrationTestCase
+class SettingsTest extends IntegrationTestCase
{
/**
* @var CorePluginSettingsTest
@@ -604,7 +606,7 @@ class Core_Plugin_SettingsTest extends IntegrationTestCase
public function test_construct_shouldDetectTheNameOfThePluginAutomatically_IfPluginNameNotGiven()
{
- $setting = new Piwik\Plugins\ExampleSettingsPlugin\Settings();
+ $setting = new \Piwik\Plugins\ExampleSettingsPlugin\Settings();
$this->assertEquals('ExampleSettingsPlugin', $setting->getPluginName());
}
@@ -671,4 +673,4 @@ class Core_Plugin_SettingsTest extends IntegrationTestCase
{
return new CorePluginSettingsTest('ExampleSettingsPlugin');
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
index 4362dacca1..2c4ab2a00d 100644
--- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
@@ -5,13 +5,24 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
+use Exception;
+use Piwik\Config;
use Piwik\Filesystem;
+use Piwik\Plugin\Manager;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
/**
+ * @group Core
* @group ReleaseCheckListTest
*/
-class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
+class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase
{
+ private $globalConfig;
+
public function setUp()
{
$this->globalConfig = _parse_ini_file(PIWIK_PATH_TEST_TO_ROOT . '/config/global.ini.php', true);
@@ -19,9 +30,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
parent::setUp();
}
- /**
- * @group Core
- */
public function test_icoFilesIconsShouldBeInPngFormat()
{
$files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins', '*.ico');
@@ -30,9 +38,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->checkFilesAreInPngFormat($files);
}
- /**
- * @group Core
- */
public function test_pngFilesIconsShouldBeInPngFormat()
{
$files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins', '*.png');
@@ -41,9 +46,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->checkFilesAreInPngFormat($files);
}
- /**
- * @group Core
- */
public function test_gifFilesIconsShouldBeInGifFormat()
{
$files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins', '*.gif');
@@ -52,9 +54,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->checkFilesAreInGifFormat($files);
}
- /**
- * @group Core
- */
public function test_jpgImagesShouldBeInJpgFormat()
{
$files = Filesystem::globr(PIWIK_INCLUDE_PATH . '/plugins', '*.jpg');
@@ -67,9 +66,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->checkFilesAreInJpgFormat($files);
}
- /**
- * @group Core
- */
public function testCheckThatConfigurationValuesAreProductionValues()
{
$this->_checkEqual(array('Debug' => 'always_archive_data_day'), '0');
@@ -106,9 +102,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->assertEquals($valueExpected, $value, "$section -> $optionName was '" . var_export($value, true) . "', expected '" . var_export($valueExpected, true) . "'");
}
- /**
- * @group Core
- */
public function testTemplatesDontContainDebug()
{
$patternFailIfFound = 'dump(';
@@ -123,9 +116,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
}
- /**
- * @group Core
- */
public function testCheckThatGivenPluginsAreDisabledByDefault()
{
$pluginsShouldBeDisabled = array(
@@ -141,7 +131,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
/**
* test that the profiler is disabled (mandatory on a production server)
- * @group Core
*/
public function testProfilingDisabledInProduction()
{
@@ -149,9 +138,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->assertTrue(\Piwik\Tracker\Db::isProfilingEnabled() === false, 'SQL profiler should be disabled in production! See Db::$profiling');
}
- /**
- * @group Core
- */
public function testPiwikTrackerDebugIsOff()
{
$this->assertTrue(!isset($GLOBALS['PIWIK_TRACKER_DEBUG']));
@@ -161,7 +147,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
/**
* This tests that all PHP files start with <?php
* This would help detect errors such as a php file starting with spaces
- * @group Core
*/
public function test_phpFilesStartWithRightCharacter()
{
@@ -187,9 +172,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
}
- /**
- * @group Core
- */
public function test_directoriesShouldBeChmod755()
{
$pluginsPath = realpath(PIWIK_INCLUDE_PATH . '/plugins/');
@@ -222,17 +204,15 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
* Check that directories in plugins/ folder are specifically either enabled or disabled.
*
* This fails when a new folder is added to plugins/* and forgot to enable or mark as disabled in Manager.php.
- *
- * @group Core
*/
public function test_DirectoriesInPluginsFolder_areKnown()
{
- $pluginsBundledWithPiwik = \Piwik\Config::getInstance()->getFromGlobalConfig('Plugins');
+ $pluginsBundledWithPiwik = Config::getInstance()->getFromGlobalConfig('Plugins');
$pluginsBundledWithPiwik = $pluginsBundledWithPiwik['Plugins'];
$magicPlugins = 42;
$this->assertTrue(count($pluginsBundledWithPiwik) > $magicPlugins);
- $plugins = _glob(\Piwik\Plugin\Manager::getPluginsDirectory() . '*', GLOB_ONLYDIR);
+ $plugins = _glob(Manager::getPluginsDirectory() . '*', GLOB_ONLYDIR);
$count = 1;
foreach($plugins as $pluginPath) {
$pluginName = basename($pluginPath);
@@ -243,7 +223,7 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
// if not added to git, then it is not part of the release checklist.
continue;
}
- $manager = \Piwik\Plugin\Manager::getInstance();
+ $manager = Manager::getInstance();
$isGitSubmodule = $manager->isPluginOfficialAndNotBundledWithCore($pluginName);
$disabled = in_array($pluginName, $manager->getCorePluginsDisabledByDefault()) || $isGitSubmodule;
@@ -258,9 +238,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->assertTrue($count > $magicPlugins);
}
- /**
- * @group Core
- */
public function testEndOfLines()
{
foreach (Filesystem::globr(PIWIK_DOCUMENT_ROOT, '*') as $file) {
@@ -300,9 +277,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
}
- /**
- * @group Core
- */
public function testPiwikJavaScript()
{
// check source against Snort rule 8443
@@ -316,9 +290,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->assertTrue(preg_match($pattern, $contents) == 0);
}
- /**
- * @param $files
- */
private function checkFilesAreInPngFormat($files)
{
$this->checkFilesAreInFormat($files, "png");
@@ -333,10 +304,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$this->checkFilesAreInFormat($files, "gif");
}
- /**
- * @param $files
- * @param $format
- */
private function checkFilesAreInFormat($files, $format)
{
$errors = array();
@@ -353,15 +320,12 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
if (!empty($errors)) {
- $icons = var_export($errors, true);
$icons = "gimp " . implode(" ", $errors);
$this->fail("$format format failed for following icons $icons \n");
}
}
/**
- * @param $file
- * @param $isIniFile
* @return bool
*/
protected function isSkipPhpFileStartWithPhpBlock($file, $isIniFile)
@@ -378,7 +342,6 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
}
/**
- * @param $pluginPath
* @return bool
*/
protected function isPathAddedToGit($pluginPath)
@@ -387,5 +350,4 @@ class Test_Piwik_ReleaseCheckListTest extends PHPUnit_Framework_TestCase
$addedToGit = (strlen($gitOutput) > 0) && strpos($gitOutput, 'error: pathspec') === false;
return $addedToGit;
}
-
}
diff --git a/tests/PHPUnit/Integration/ReportTest.php b/tests/PHPUnit/Integration/ReportTest.php
index a9a3ef74be..13c404375c 100644
--- a/tests/PHPUnit/Integration/ReportTest.php
+++ b/tests/PHPUnit/Integration/ReportTest.php
@@ -6,6 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration;
+
use Piwik\API\Proxy;
use Piwik\Plugin\Report;
use Piwik\Plugins\ExampleReport\Reports\GetExampleReport;
@@ -72,7 +74,7 @@ class GetDisabledReport extends GetBasicReport
/**
* @group Core
*/
-class Plugin_ReportTest extends IntegrationTestCase
+class ReportTest extends IntegrationTestCase
{
/**
* @var Report
@@ -540,4 +542,4 @@ class Plugin_ReportTest extends IntegrationTestCase
{
Translate::reloadLanguage('en');
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/SegmentTest.php b/tests/PHPUnit/Integration/SegmentTest.php
index c4721b2339..889f4a8e04 100644
--- a/tests/PHPUnit/Integration/SegmentTest.php
+++ b/tests/PHPUnit/Integration/SegmentTest.php
@@ -5,12 +5,18 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
+namespace Piwik\Tests\Integration;
+
+use Exception;
use Piwik\Access;
use Piwik\Common;
use Piwik\Segment;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
+ * @group Core
* @group SegmentTest
*/
class SegmentTest extends IntegrationTestCase
@@ -91,7 +97,6 @@ class SegmentTest extends IntegrationTestCase
/**
* @dataProvider getCommonTestData
- * @group Core
*/
public function testCommon($segment, $expected)
{
@@ -121,9 +126,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals(32, strlen($segment->getHash()));
}
- /**
- * @group Core
- */
public function testGetSelectQueryNoJoin()
{
$select = '*';
@@ -151,9 +153,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinVisitOnAction()
{
$select = '*';
@@ -182,9 +181,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinActionOnVisit()
{
$select = 'sum(log_visit.visit_total_actions) as nb_actions, max(log_visit.visit_total_actions) as max_actions, sum(log_visit.visit_total_time) as sum_visit_length';
@@ -220,9 +216,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinConversionOnAction()
{
$select = '*';
@@ -251,9 +244,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinActionOnConversion()
{
$select = '*';
@@ -282,9 +272,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinConversionOnVisit()
{
$select = 'log_visit.*';
@@ -319,9 +306,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryConversionOnly()
{
$select = 'log_conversion.*';
@@ -349,9 +333,6 @@ class SegmentTest extends IntegrationTestCase
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
}
- /**
- * @group Core
- */
public function testGetSelectQueryJoinVisitOnConversion()
{
$select = '*';
@@ -383,8 +364,6 @@ class SegmentTest extends IntegrationTestCase
/**
* visit is joined on action, then conversion is joined
* make sure that conversion is joined on action not visit
- *
- * @group Core
*/
public function testGetSelectQueryJoinVisitAndConversionOnAction()
{
@@ -416,8 +395,6 @@ class SegmentTest extends IntegrationTestCase
/**
* join conversion on visit, then actions
* make sure actions are joined before conversions
- *
- * @group Core
*/
public function testGetSelectQueryJoinConversionAndActionOnVisit()
{
@@ -465,14 +442,12 @@ class SegmentTest extends IntegrationTestCase
}
/**
- * @group Core
- *
* @dataProvider getBogusSegments
*/
public function testBogusSegmentThrowsException($segment)
{
try {
- $segment = new Segment($segment, $idSites = array());
+ new Segment($segment, $idSites = array());
} catch (Exception $e) {
return;
}
diff --git a/tests/PHPUnit/Integration/ServeStaticFileTest.php b/tests/PHPUnit/Integration/ServeStaticFileTest.php
index 236bc748c3..d7f19a30e5 100644
--- a/tests/PHPUnit/Integration/ServeStaticFileTest.php
+++ b/tests/PHPUnit/Integration/ServeStaticFileTest.php
@@ -11,10 +11,11 @@
* serverStaticFile.test.php has been created to avoid making too many modifications to /tests/core/Piwik.test.php
*/
-// This is Piwik logo, the static file used in this test suit
+namespace Piwik\Tests\Integration;
-// TODO this is an integration or system test! not a unit test
+// This is Piwik logo, the static file used in this test suit
+use Exception;
use Piwik\ProxyHttp;
use Piwik\SettingsServer;
use Piwik\Tests\Framework\Fixture;
@@ -46,7 +47,7 @@ define("PARTIAL_BYTE_START", 1204);
define("PARTIAL_BYTE_END", 14724);
// If the static file server has not been requested, the standard unit test case class is defined
-class Test_Piwik_ServeStaticFile extends PHPUnit_Framework_TestCase
+class ServeStaticFileTest extends \PHPUnit_Framework_TestCase
{
public function tearDown()
{
diff --git a/tests/PHPUnit/Integration/SqlTest.php b/tests/PHPUnit/Integration/SqlTest.php
index aed82013c9..c5f673f17e 100755
--- a/tests/PHPUnit/Integration/SqlTest.php
+++ b/tests/PHPUnit/Integration/SqlTest.php
@@ -1,16 +1,20 @@
<?php
-use Piwik\Db;
-use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
-
/**
* 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\Integration;
+
+use Piwik\Db;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+
+/**
* @group Core
*/
-class Core_SqlTest extends IntegrationTestCase
+class SqlTest extends IntegrationTestCase
{
public function setUp()
{
@@ -30,9 +34,6 @@ class Core_SqlTest extends IntegrationTestCase
parent::tearDown();
}
- /**
- * @group Core
- */
public function testOptimize()
{
// make sure optimizing myisam tables works
diff --git a/tests/PHPUnit/Integration/Tracker/ActionTest.php b/tests/PHPUnit/Integration/Tracker/ActionTest.php
index dd3388a56c..1ca87f9678 100644
--- a/tests/PHPUnit/Integration/Tracker/ActionTest.php
+++ b/tests/PHPUnit/Integration/Tracker/ActionTest.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\Integration\Tracker;
+
use Piwik\Access;
use Piwik\Config;
use Piwik\Plugins\SitesManager\API;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tracker\Action;
use Piwik\Tracker\PageUrl;
use Piwik\Tracker\Request;
@@ -16,15 +20,10 @@ use Piwik\Plugin\Manager as PluginManager;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
* @group Core
* @group ActionTest
*/
-class Core_Tracker_ActionTest extends IntegrationTestCase
+class ActionTest extends IntegrationTestCase
{
public function setUp()
{
@@ -123,7 +122,6 @@ class Core_Tracker_ActionTest extends IntegrationTestCase
/**
* No excluded query parameters specified, apart from the standard "session" parameters, always excluded
*
- * @group Core
* @dataProvider getTestUrls
*/
public function testExcludeQueryParametersNone($url, $filteredUrl)
@@ -151,7 +149,6 @@ class Core_Tracker_ActionTest extends IntegrationTestCase
/**
* Test removing hash tag
- * @group Core
* @dataProvider getTestUrlsHashtag
*/
public function testRemoveTrailingHashtag($url, $expectedUrl)
@@ -161,7 +158,6 @@ class Core_Tracker_ActionTest extends IntegrationTestCase
/**
* Testing with some website specific parameters excluded
- * @group Core
* @dataProvider getTestUrls
*/
public function testExcludeQueryParametersSiteExcluded($url, $filteredUrl)
@@ -177,7 +173,6 @@ class Core_Tracker_ActionTest extends IntegrationTestCase
/**
* Testing with some website specific and some global excluded query parameters
- * @group Core
* @dataProvider getTestUrls
*/
public function testExcludeQueryParametersSiteAndGlobalExcluded($url, $filteredUrl)
@@ -367,7 +362,6 @@ class Core_Tracker_ActionTest extends IntegrationTestCase
/**
* @dataProvider getExtractUrlData
- * @group Core
*/
public function testExtractUrlAndActionNameFromRequest($request, $expected)
{
diff --git a/tests/PHPUnit/Integration/Tracker/DbTest.php b/tests/PHPUnit/Integration/Tracker/DbTest.php
index 8bfdd5232f..e55d87d2ef 100644
--- a/tests/PHPUnit/Integration/Tracker/DbTest.php
+++ b/tests/PHPUnit/Integration/Tracker/DbTest.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\Integration\Tracker;
+
use Piwik\Common;
use Piwik\Db;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+use Piwik\Tracker;
/**
* Tracker DB test
@@ -15,11 +19,11 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
* @group Core
* @group TrackerDbTest
*/
-class Core_Tracker_DbTest extends IntegrationTestCase
+class DbTest extends IntegrationTestCase
{
public function test_rowCount_whenUpdating_returnsAllMatchedRowsNotOnlyUpdatedRows()
{
- $db = \Piwik\Tracker::getDatabase();
+ $db = Tracker::getDatabase();
// insert one record
$db->query("INSERT INTO `" . Common::prefixTable('option') . "` VALUES ('rowid', '1', false)");
@@ -39,5 +43,4 @@ class Core_Tracker_DbTest extends IntegrationTestCase
$result = $db->query($sqlUpdate . " WHERE option_name = 'rowid'");
$this->assertSame(1, $db->rowCount($result));
}
-
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/Tracker/Visit2Test.php b/tests/PHPUnit/Integration/Tracker/Visit2Test.php
index 5c191d90ee..3a64c6e54b 100644
--- a/tests/PHPUnit/Integration/Tracker/Visit2Test.php
+++ b/tests/PHPUnit/Integration/Tracker/Visit2Test.php
@@ -6,11 +6,13 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\Tracker;
// Tests Visits and Dimensions behavior which is a lot of logic so not in VisitTest
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Tracker\Request;
+use Piwik\Tracker\Visit;
use Piwik\Tracker\Visitor;
use Piwik\Piwik;
use Piwik\EventDispatcher;
@@ -88,7 +90,7 @@ class FakeTrackerVisitDimension4 extends VisitDimension
}
-class FakeTrackerVisit extends \Piwik\Tracker\Visit
+class FakeTrackerVisit extends Visit
{
public function __construct($request)
{
@@ -124,12 +126,10 @@ class FakeTrackerVisit extends \Piwik\Tracker\Visit
protected function insertNewVisit($visit)
{
-
}
protected function updateExistingVisit($valuesToUpdate)
{
-
}
}
@@ -137,9 +137,8 @@ class FakeTrackerVisit extends \Piwik\Tracker\Visit
* @group Core
* @group VisitTest
*/
-class VisitTest extends IntegrationTestCase
+class Visit2Test extends IntegrationTestCase
{
-
public function setUp()
{
parent::setUp();
@@ -157,8 +156,8 @@ class VisitTest extends IntegrationTestCase
public function test_handleNewVisitWithoutConversion_shouldTriggerDimensions()
{
- $request = new \Piwik\Tracker\Request(array());
- $visitor = new \Piwik\Tracker\Visitor($request, '');
+ $request = new Request(array());
+ $visitor = new Visitor($request, '');
$visit = new FakeTrackerVisit($request);
$visit->handleNewVisit($visitor, null, false);
@@ -179,8 +178,8 @@ class VisitTest extends IntegrationTestCase
public function test_handleNewVisitWithConversion_shouldTriggerDimensions()
{
- $request = new \Piwik\Tracker\Request(array());
- $visitor = new \Piwik\Tracker\Visitor($request, '');
+ $request = new Request(array());
+ $visitor = new Visitor($request, '');
$visit = new FakeTrackerVisit($request);
$visit->handleNewVisit($visitor, null, true);
@@ -197,8 +196,8 @@ class VisitTest extends IntegrationTestCase
public function test_handleExistingVisitWithoutConversion_shouldTriggerDimensions()
{
- $request = new \Piwik\Tracker\Request(array());
- $visitor = new \Piwik\Tracker\Visitor($request, '');
+ $request = new Request(array());
+ $visitor = new Visitor($request, '');
$visit = new FakeTrackerVisit($request);
$visit->handleNewVisit($visitor, null, false);
@@ -220,8 +219,8 @@ class VisitTest extends IntegrationTestCase
public function test_handleExistingVisitWithConversion_shouldTriggerDimensions()
{
- $request = new \Piwik\Tracker\Request(array());
- $visitor = new \Piwik\Tracker\Visitor($request, '');
+ $request = new Request(array());
+ $visitor = new Visitor($request, '');
$visit = new FakeTrackerVisit($request);
$visit->handleNewVisit($visitor, null, false);
@@ -236,4 +235,4 @@ class VisitTest extends IntegrationTestCase
$this->assertEquals('converted3', $visitor->getVisitorColumn('custom_dimension_3'));
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php
index 292b98737d..3a516d1c53 100644
--- a/tests/PHPUnit/Integration/Tracker/VisitTest.php
+++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php
@@ -6,19 +6,21 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\Tracker;
+
use Piwik\Access;
use Piwik\Network\IPUtils;
+use Piwik\Plugin\Manager;
use Piwik\Plugins\SitesManager\API;
+use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tracker\Request;
use Piwik\Tracker\VisitExcluded;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_Tracker_VisitTest
- *
* @group Core
*/
-class Core_Tracker_VisitTest extends IntegrationTestCase
+class VisitTest extends IntegrationTestCase
{
public function setUp()
{
@@ -29,7 +31,7 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
FakeAccess::$superUser = true;
Access::setSingletonInstance($pseudoMockAccess);
- \Piwik\Plugin\Manager::getInstance()->loadPlugins(array('SitesManager'));
+ Manager::getInstance()->loadPlugins(array('SitesManager'));
}
/**
@@ -75,7 +77,6 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
}
/**
- * @group Core
* @dataProvider getExcludedIpTestData
*/
public function testIsVisitorIpExcluded($excludedIp, $tests)
@@ -120,7 +121,6 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
}
/**
- * @group Core
* @dataProvider getExcludedUserAgentTestData
*/
public function testIsVisitorUserAgentExcluded($excludedUserAgent, $tests)
@@ -143,7 +143,6 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
}
/**
- * @group Core
* @group referrerIsKnownSpam
*/
public function testIsVisitor_referrerIsKnownSpam()
@@ -173,7 +172,6 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
}
/**
- * @group Core
* @group IpIsKnownBot
*/
public function testIsVisitor_ipIsKnownBot()
@@ -203,7 +201,6 @@ class Core_Tracker_VisitTest extends IntegrationTestCase
}
/**
- * @group Core
* @group UserAgentIsKnownBot
*/
public function testIsVisitor_userAgentIsKnownBot()
diff --git a/tests/PHPUnit/Integration/TrackerTest.php b/tests/PHPUnit/Integration/TrackerTest.php
index 0da7445964..bc4c99090c 100644
--- a/tests/PHPUnit/Integration/TrackerTest.php
+++ b/tests/PHPUnit/Integration/TrackerTest.php
@@ -5,11 +5,11 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
namespace Piwik\Tests\Integration;
use Piwik\Common;
use Piwik\Db;
-use Piwik\Option;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\Tracker;
diff --git a/tests/PHPUnit/Integration/TravisEnvironmentTest.php b/tests/PHPUnit/Integration/TravisEnvironmentTest.php
index 5faf9cbe10..60a3664bc2 100644
--- a/tests/PHPUnit/Integration/TravisEnvironmentTest.php
+++ b/tests/PHPUnit/Integration/TravisEnvironmentTest.php
@@ -1,14 +1,21 @@
<?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\Integration;
+
+use Piwik\Db;
use Piwik\Translate;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class TravisEnvironmentTest
- *
* @group Core
*/
-class Core_TravisEnvironmentTest extends IntegrationTestCase
+class TravisEnvironmentTest extends IntegrationTestCase
{
public function testUsageOfCorrectMysqlAdapter()
{
@@ -20,17 +27,16 @@ class Core_TravisEnvironmentTest extends IntegrationTestCase
$this->assertTrue(in_array($mysqlAdapter, array('PDO_MYSQL', 'PDO\MYSQL', 'MYSQLI')));
- $db = Piwik\Db::get();
+ $db = Db::get();
switch ($mysqlAdapter) {
case 'PDO_MYSQL':
case 'PDO\MYSQL':
- $this->assertInstanceOf('\Piwik\Db\Adapter\Pdo\Mysql', $db);
+ $this->assertInstanceOf('Piwik\Db\Adapter\Pdo\Mysql', $db);
break;
case 'MYSQLI':
- $this->assertInstanceOf('\Piwik\Db\Adapter\Mysqli', $db);
+ $this->assertInstanceOf('Piwik\Db\Adapter\Mysqli', $db);
break;
}
-
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/UpdaterTest.php b/tests/PHPUnit/Integration/UpdaterTest.php
index 563de9abfe..c15d6b0a88 100644
--- a/tests/PHPUnit/Integration/UpdaterTest.php
+++ b/tests/PHPUnit/Integration/UpdaterTest.php
@@ -5,15 +5,14 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-namespace Piwik\Tests\Integration\Core;
+
+namespace Piwik\Tests\Integration;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\Updater;
use Piwik\Tests\Framework\Fixture;
/**
- * Class Core_UpdaterTest
- *
* @group Core
* @group Core_UpdaterTest
*/
@@ -74,4 +73,4 @@ class UpdaterTest extends IntegrationTestCase
throw new \Exception("Failed to force update (nothing to update).");
}
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php b/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php
index b6ef41d9f6..cc2d6b97aa 100644
--- a/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php
+++ b/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php
@@ -6,18 +6,18 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration\ViewDataTable;
+
use Piwik\Access;
use Piwik\ViewDataTable\Manager as ViewDataTableManager;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_Plugin_SettingsTest
* @group Core
* @group ViewDataTable
*/
-class Core_Plugin_ViewDataTable_ManagerTest extends IntegrationTestCase
+class ManagerTest extends IntegrationTestCase
{
-
public function setUp()
{
parent::setUp();
@@ -103,4 +103,4 @@ class Core_Plugin_ViewDataTable_ManagerTest extends IntegrationTestCase
return array('login' => $login, 'method' => $method, 'params' => $params);
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Integration/WidgetsListTest.php b/tests/PHPUnit/Integration/WidgetsListTest.php
index b5c5739365..430db34ced 100644
--- a/tests/PHPUnit/Integration/WidgetsListTest.php
+++ b/tests/PHPUnit/Integration/WidgetsListTest.php
@@ -6,22 +6,21 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+namespace Piwik\Tests\Integration;
+
use Piwik\Access;
use Piwik\Plugins\Goals\API;
+use Piwik\Tests\Framework\Mock\FakeAccess;
+use Piwik\Translate;
use Piwik\WidgetsList;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
/**
- * Class Core_WidgetsListTest
- *
* @group Core
*/
class Core_WidgetsListTest extends IntegrationTestCase
{
- /**
- * @group Core
- */
public function testGet()
{
// setup the access layer
@@ -62,9 +61,6 @@ class Core_WidgetsListTest extends IntegrationTestCase
}
}
- /**
- * @group Core
- */
public function testGetWithGoals()
{
// setup the access layer
@@ -94,9 +90,6 @@ class Core_WidgetsListTest extends IntegrationTestCase
}
}
- /**
- * @group Core
- */
public function testGetWithGoalsAndEcommerce()
{
// setup the access layer
@@ -127,9 +120,6 @@ class Core_WidgetsListTest extends IntegrationTestCase
}
}
- /**
- * @group Core
- */
public function testRemove()
{
// setup the access layer
@@ -167,9 +157,6 @@ class Core_WidgetsListTest extends IntegrationTestCase
WidgetsList::_reset();
}
- /**
- * @group Core
- */
public function testIsDefined()
{
// setup the access layer
@@ -177,7 +164,7 @@ class Core_WidgetsListTest extends IntegrationTestCase
FakeAccess::$superUser = true;
Access::setSingletonInstance($pseudoMockAccess);
- \Piwik\Translate::loadEnglishTranslation();
+ Translate::loadEnglishTranslation();
Fixture::createWebsite('2009-01-04 00:11:42', true);
diff --git a/tests/resources/TestPluginLogClass.php b/tests/resources/TestPluginLogClass.php
index 75f28928c4..3a95fe0cfb 100644
--- a/tests/resources/TestPluginLogClass.php
+++ b/tests/resources/TestPluginLogClass.php
@@ -5,6 +5,7 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+
namespace Piwik\Plugins\TestPlugin;
use Piwik\Log;
@@ -15,4 +16,4 @@ class TestLoggingUtility
{
Log::warning($message);
}
-} \ No newline at end of file
+}