diff --git a/tests/PHPUnit/Integration/AccessTest.php b/tests/PHPUnit/Integration/AccessTest.php index 94143fff5ef9efab87231c9b93c10de7704bdc2f..9ccf69b11bee9e9e66fab514e43558a05d9538b7 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 6514a101341b47513fa5ef93f25966d2582cf4b6..7c9f24e096aedd00187d7f5df9e0cd283aaeb296 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 968c68c35fa2f9217befdf0eff2d76084a9b09db..e1dc6c4a3c7990beb5b04a711fa444be3c796ae9 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 259df6fc9e247be6d63410f533313f40a698db64..3f74af2bec54d33bbeab18b5d195c25eb7c57bd0 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 43962ff17b1f6076a3389ac76c5b7b94d0ff11e1..6e3959ceda5bce02d79ab3a637849ff24173268a 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 270253b82a727334a20135fe02cefd72eaa6c000..1ec10bdebfeeb6792a2cf21d90fb32c044bd83c2 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 c7a8e465eb4207f516ea6d6605a758a3fb214d78..e450ec7bae28178091ad4ec47e10a9f348768932 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 similarity index 89% rename from tests/PHPUnit/Core/API/DocumentationGeneratorTest.php rename to tests/PHPUnit/Integration/DocumentationGeneratorTest.php index 5fb119f6a0621490135d70006b2108d56c488e1c..253844cd18340eedbac7ae14416ba7da3d03b03c 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 68988d78a96dfecfd039b643b76279ffca812fad..a5d62b30604675dfd0b4d45ade50d1c2125d7da6 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 92a6461acc45cd2b4590c4b5297e08cba89cc102..e968fec50ef4c27c8b60b20ebfdeb0b21b0d4c55 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 8934e31e856a2eeeae34f8c3964aa113f2cfe584..0e61fa00fff31bc9604d04af0dc9f1cd99184633 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 0e6b8cba7d93cdb1b4f37c903220ac1b4d31bf20..616202f05ff621f160598ab722b41b98ee844323 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 46cc79f0d2c3f55c2c1708e96a4e7342860127f6..252c08cd783216c35b411ff46a17e720a0a22df4 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 ffec54ce5808159b4636392a632749742d9dd3fa..763ce4f09a22913f8584277cc7b4f2b0c385bc5b 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 4362dacca13ba4781a550ab82b3440b3900a12af..2c4ab2a00de1211059222080c5711e038ecf65d1 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 a9a3ef74be59d7cc6cf4d194fd99adff7eff022d..13c404375c6df5bf8dd9817f52602bf1dc28adcb 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 c4721b233975fd5f2b41469b19d8a51b6294366a..889f4a8e04be5ec3a8ce8829eb5929451429b532 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 236bc748c3351341f173dff6f9fd5f83352934e2..d7f19a30e5a41ac11d7974cc1f8d4775105d72b0 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 aed82013c974695e7ef7f29aa75b9a809a408b67..c5f673f17ea3f56b4409e0308b04c68b1fce7676 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 dd3388a56cc943bc8af9c00e471fcab32b455011..1ca87f96785e7728847dc76592170b78c588590b 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 8bfdd5232f5df069eab2d4a23d3104e8eff9115e..e55d87d2efc7119fa9861332322f2bb027ba2c39 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 5c191d90ee97ec4c0e262ad5b38ea9ff4d93ad37..3a64c6e54b286e442ce1f3ebebaefed2ed782438 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 292b98737d03c485257f5641082c8a0389783341..3a516d1c53be2b9a6bba990bb42e3c3e75a530c1 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 0da7445964747faee0ca16cb8ac5243665921e6c..bc4c99090c83d682d7c27fb10150827613497114 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 5faf9cbe1005cdae4de6c5cd5ba400939d284a73..60a3664bc2d2c6dba6cf184c6ec45f93a009d495 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 563de9abfed8dbc61c747a6e8fc7460fcb098669..c15d6b0a887bf4c88bf35fc48d2180da66dfe4eb 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 b6ef41d9f6727e62ecc65df02ff2099f52f8cf74..cc2d6b97aaf62f7c190c6418a4c0b2f8b3f3d1f7 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 b5c5739365e5ca22455b37ead63cb9504837e3b3..430db34cedc0fe88342bb7d070c31aae3a69a0f1 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 75f28928c4029250515486fe960a1f16927dd45d..3a95fe0cfb9d2c3e1ac47d1dc7ef2e6553c25ef2 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 +}