diff options
author | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-07-18 13:45:02 +0400 |
---|---|---|
committer | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-07-18 13:45:02 +0400 |
commit | 03b4953f008c1063e6d7166143ba844e8c6e89cc (patch) | |
tree | 7b9f0fef13d75417c551f813c98dba1a22f2fff3 /tests | |
parent | 9b2c0a7a450fff3b634f8119c8003ae1d20b97d0 (diff) |
Refactor class Piwik_Common to \Piwik\Core\Common
Notice that auto refactoring has created a nested namespace. Not sure this is what we want - so we might have to edit those nested namespaces afterwards (I think they don't look so good)
Diffstat (limited to 'tests')
19 files changed, 163 insertions, 163 deletions
diff --git a/tests/PHPUnit/BaseFixture.php b/tests/PHPUnit/BaseFixture.php index 812fdc2960..88f90a471b 100644 --- a/tests/PHPUnit/BaseFixture.php +++ b/tests/PHPUnit/BaseFixture.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Base type for all integration test fixtures. Integration test fixtures @@ -64,7 +64,7 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert ); // Manually set the website creation date to a day earlier than the earliest day we record stats for - Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), + Zend_Registry::get('db')->update(Common::prefixTable("site"), array('ts_created' => Piwik_Date::factory($dateTime)->subDay(1)->getDatetime()), "idsite = $idSite" ); @@ -333,7 +333,7 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert protected static function executeLogImporter($logFile, $options) { - $python = Piwik_Common::isWindows() ? "C:\Python27\python.exe" : 'python'; + $python = Common::isWindows() ? "C:\Python27\python.exe" : 'python'; // create the command $cmd = $python diff --git a/tests/PHPUnit/BenchmarkTestCase.php b/tests/PHPUnit/BenchmarkTestCase.php index 72df0a58dc..3f753e401b 100755 --- a/tests/PHPUnit/BenchmarkTestCase.php +++ b/tests/PHPUnit/BenchmarkTestCase.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/LocalTracker.php'; @@ -47,7 +47,7 @@ abstract class BenchmarkTestCase extends IntegrationTestCase try { if (isset(self::$fixture->tablesPrefix)) { Config::getInstance()->database['tables_prefix'] = self::$fixture->tablesPrefix; - Piwik_Common::$cachedTablePrefix = null; + Common::$cachedTablePrefix = null; } Piwik_Query("USE " . $dbName); diff --git a/tests/PHPUnit/Benchmarks/Fixtures/SqlDump.php b/tests/PHPUnit/Benchmarks/Fixtures/SqlDump.php index ee8a4f8b49..2f6a75143b 100755 --- a/tests/PHPUnit/Benchmarks/Fixtures/SqlDump.php +++ b/tests/PHPUnit/Benchmarks/Fixtures/SqlDump.php @@ -7,7 +7,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Reusable fixture. Loads a ~1GB SQL dump into the DB. @@ -57,7 +57,7 @@ class Piwik_Test_Fixture_SqlDump $password = Config::getInstance()->database['password']; $dbName = Config::getInstance()->database['dbname']; Config::getInstance()->database['tables_prefix'] = 'piwik_'; - Piwik_Common::$cachedTablePrefix = null; + Common::$cachedTablePrefix = null; exec("mysql -u \"$user\" \"--password=$password\" $dbName < \"" . $deflatedDumpPath . "\" 2>&1", $output, $return); if ($return !== 0) { diff --git a/tests/PHPUnit/Core/ArchiveProcessingTest.php b/tests/PHPUnit/Core/ArchiveProcessingTest.php index dd1e9a8186..8a73c11113 100644 --- a/tests/PHPUnit/Core/ArchiveProcessingTest.php +++ b/tests/PHPUnit/Core/ArchiveProcessingTest.php @@ -1,7 +1,7 @@ <?php use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -181,7 +181,7 @@ class ArchiveProcessingTest extends DatabaseTestCase // see isArchivingDisabled() // Running in CLI doesn't impact the time to live today's archive we are loading // From CLI, we will not return data that is 'stale' - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $dateMinArchived = 0; } $this->compareTimestamps($archiveProcessor->getMinTimeArchivedProcessed(), $dateMinArchived); @@ -224,7 +224,7 @@ class ArchiveProcessingTest extends DatabaseTestCase // see isArchivingDisabled() // Running in CLI doesn't impact the time to live today's archive we are loading // From CLI, we will not return data that is 'stale' - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $dateMinArchived = 0; } $this->compareTimestamps($dateMinArchived, $archiveProcessor->getMinTimeArchivedProcessed()); @@ -270,7 +270,7 @@ class ArchiveProcessingTest extends DatabaseTestCase // see isArchivingDisabled() // Running in CLI doesn't impact the time to live today's archive we are loading // From CLI, we will not return data that is 'stale' - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $dateMinArchived = 0; } $this->compareTimestamps($dateMinArchived, $archiveProcessor->getMinTimeArchivedProcessed()); @@ -291,7 +291,7 @@ class ArchiveProcessingTest extends DatabaseTestCase */ public function testTableInsertBatch() { - $table = Piwik_Common::prefixTable('site_url'); + $table = Common::prefixTable('site_url'); $data = $this->_getDataInsert(); try { $didWeUseBulk = Piwik::tableInsertBatch($table, @@ -343,7 +343,7 @@ class ArchiveProcessingTest extends DatabaseTestCase */ public function testTableInsertBatchIterate() { - $table = Piwik_Common::prefixTable('site_url'); + $table = Common::prefixTable('site_url'); $data = $this->_getDataInsert(); Piwik::tableInsertBatchIterate($table, array('idsite', 'url'), $data); $this->_checkTableIsExpected($table, $data); diff --git a/tests/PHPUnit/Core/CommonTest.php b/tests/PHPUnit/Core/CommonTest.php index f8d7b431b7..0163ff548a 100644 --- a/tests/PHPUnit/Core/CommonTest.php +++ b/tests/PHPUnit/Core/CommonTest.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -44,7 +44,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testIsUrl($url, $isValid) { - $this->assertEquals($isValid, Piwik_Common::isLookLikeUrl($url)); + $this->assertEquals($isValid, Common::isLookLikeUrl($url)); } /** @@ -134,11 +134,11 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase if (version_compare(PHP_VERSION, '5.4') < 0) { $this->assertTrue(@set_magic_quotes_runtime(1)); $this->assertEquals(1, @get_magic_quotes_runtime()); - $this->assertEquals($output, Piwik_Common::sanitizeInputValues($input)); + $this->assertEquals($output, Common::sanitizeInputValues($input)); $this->assertTrue(@set_magic_quotes_runtime(0)); $this->assertEquals(0, @get_magic_quotes_runtime()); - $this->assertEquals($output, Piwik_Common::sanitizeInputValues($input)); + $this->assertEquals($output, Common::sanitizeInputValues($input)); } } @@ -152,7 +152,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase { try { $_GET[''] = 1; - Piwik_Common::getRequestVar(''); + Common::getRequestVar(''); } catch (Exception $e) { return; } @@ -168,7 +168,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase public function testGetRequestVarNoDefaultNoTypeNoValue() { try { - Piwik_Common::getRequestVar('test'); + Common::getRequestVar('test'); } catch (Exception $e) { return; } @@ -184,7 +184,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase public function testGetRequestVarNoDefaultNoTypeWithValue() { $_GET['test'] = 1413.431413; - $this->assertEquals($_GET['test'], Piwik_Common::getRequestVar('test')); + $this->assertEquals($_GET['test'], Common::getRequestVar('test')); } @@ -198,7 +198,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase { try { $_GET['test'] = 1413.431413; - Piwik_Common::getRequestVar('test', null, 'string'); + Common::getRequestVar('test', null, 'string'); } catch (Exception $e) { return; } @@ -214,7 +214,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase public function testGetRequestVarNoDefaultWithTypeWithValue2() { try { - Piwik_Common::getRequestVar('test', null, 'string'); + Common::getRequestVar('test', null, 'string'); } catch (Exception $e) { return; } @@ -268,7 +268,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase public function testGetRequestVar($varValue, $default, $type, $expected) { $_GET['test'] = $varValue; - $return = Piwik_Common::getRequestVar('test', $default, $type); + $return = Common::getRequestVar('test', $default, $type); $this->assertEquals($expected, $return); // validate correct type switch ($type) { @@ -340,7 +340,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testGetParameterFromQueryString($queryString, $parameter, $expected) { - $this->assertSame($expected, Piwik_Common::getParameterFromQueryString($queryString, $parameter)); + $this->assertSame($expected, Common::getParameterFromQueryString($queryString, $parameter)); } /** @@ -350,7 +350,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testGetPathAndQueryFromUrl() { - $this->assertEquals('test/index.php?module=CoreHome', Piwik_Common::getPathAndQueryFromUrl('http://piwik.org/test/index.php?module=CoreHome')); + $this->assertEquals('test/index.php?module=CoreHome', Common::getPathAndQueryFromUrl('http://piwik.org/test/index.php?module=CoreHome')); } /** @@ -369,7 +369,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase 'f' => array('a'), 'g' => array('b', 'c'), ); - $this->assertEquals(serialize($expected), serialize(Piwik_Common::getArrayFromQueryString('a&b=&c=1&d[]&e[]=&f[]=a&g[]=b&g[]=c'))); + $this->assertEquals(serialize($expected), serialize(Common::getArrayFromQueryString('a&b=&c=1&d[]&e[]=&f[]=a&g[]=b&g[]=c'))); } /** @@ -383,7 +383,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase "test", "test.txt", "test.......", "en-ZHsimplified", ); foreach ($valid as $toTest) { - $this->assertTrue(Piwik_Common::isValidFilename($toTest), $toTest . " not valid!"); + $this->assertTrue(Common::isValidFilename($toTest), $toTest . " not valid!"); } } @@ -398,7 +398,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase "../test", "/etc/htpasswd", '$var', ';test', '[bizarre]', '', ".htaccess", "very long long eogaioge ageja geau ghaeihieg heiagie aiughaeui hfilename", ); foreach ($notvalid as $toTest) { - $this->assertFalse(Piwik_Common::isValidFilename($toTest), $toTest . " valid but shouldn't!"); + $this->assertFalse(Common::isValidFilename($toTest), $toTest . " valid but shouldn't!"); } } @@ -446,7 +446,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testGetBrowserLanguage($useragent, $browserLanguage) { - $res = Piwik_Common::getBrowserLanguage($useragent); + $res = Common::getBrowserLanguage($useragent); $this->assertEquals($browserLanguage, $res); } @@ -466,7 +466,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase array("fr-fr,fr-ca", array("us" => 'amn', "ca" => 'amn'), "ca"), array("fr-fr;q=1.0,fr-ca;q=0.9", array("us" => 'amn', "ca" => 'amn'), "ca"), array("fr-ca,fr;q=0.1", array("us" => 'amn', "ca" => 'amn'), "ca"), - array("en-us,en;q=0.5", Piwik_Common::getCountriesList(), "us"), + array("en-us,en;q=0.5", Common::getCountriesList(), "us"), array("fr-ca,fr;q=0.1", array("fr" => 'eur', "us" => 'amn', "ca" => 'amn'), "ca"), array("fr-fr,fr-ca", array("fr" => 'eur', "us" => 'amn', "ca" => 'amn'), "fr") ); @@ -482,8 +482,8 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase { include 'DataFiles/LanguageToCountry.php'; - $this->assertEquals($expected, Piwik_Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, true)); - $this->assertEquals($expected, Piwik_Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, false)); + $this->assertEquals($expected, Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, true)); + $this->assertEquals($expected, Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, false)); } /** @@ -511,10 +511,10 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase include "DataFiles/LanguageToCountry.php"; // do not infer country from language - $this->assertEquals($expected, Piwik_Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess = false)); + $this->assertEquals($expected, Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess = false)); // infer country from language - $this->assertEquals($expectedInfer, Piwik_Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess = true)); + $this->assertEquals($expectedInfer, Common::extractCountryCodeFromBrowserLanguage($browserLanguage, $validCountries, $enableLanguageToCountryGuess = true)); } /** @@ -549,7 +549,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testExtractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages, $expected) { - $this->assertEquals($expected, Piwik_Common::extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages), "test with {$browserLanguage} failed, expected {$expected}"); + $this->assertEquals($expected, Common::extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages), "test with {$browserLanguage} failed, expected {$expected}"); } /** @@ -607,7 +607,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase public function testExtractSearchEngineInformationFromUrl($url, $engine, $keywords) { $this->includeDataFilesForSearchEngineTest(); - $returnedValue = Piwik_Common::extractSearchEngineInformationFromUrl($url); + $returnedValue = Common::extractSearchEngineInformationFromUrl($url); $exptectedValue = false; @@ -645,7 +645,7 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase */ public function testGetLossyUrl($input, $expected) { - $this->assertEquals($expected, Piwik_Common::getLossyUrl($input)); + $this->assertEquals($expected, Common::getLossyUrl($input)); } private function includeDataFilesForSearchEngineTest() diff --git a/tests/PHPUnit/Core/IPTest.php b/tests/PHPUnit/Core/IPTest.php index 3ca6be38dc..375f441fa3 100644 --- a/tests/PHPUnit/Core/IPTest.php +++ b/tests/PHPUnit/Core/IPTest.php @@ -1,6 +1,6 @@ <?php use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -357,7 +357,7 @@ class IPTest extends PHPUnit_Framework_TestCase { $this->assertEquals($P, Piwik_IP::long2ip($N), bin2hex($N)); // this is our compatibility function - $this->assertEquals($P, Piwik_Common::long2ip($N), bin2hex($N)); + $this->assertEquals($P, Common::long2ip($N), bin2hex($N)); } /** @@ -691,7 +691,7 @@ class IPTest extends PHPUnit_Framework_TestCase $hosts = array('localhost', 'localhost.localdomain', strtolower(@php_uname('n')), '127.0.0.1'); $this->assertTrue(in_array(strtolower(Piwik_IP::getHostByAddr('127.0.0.1')), $hosts), '127.0.0.1 -> localhost'); - if (!Piwik_Common::isWindows() || PHP_VERSION >= '5.3') { + if (!Common::isWindows() || PHP_VERSION >= '5.3') { $hosts = array('ip6-localhost', 'localhost', 'localhost.localdomain', strtolower(@php_uname('n')), '::1'); $this->assertTrue(in_array(strtolower(Piwik_IP::getHostByAddr('::1')), $hosts), '::1 -> ip6-localhost'); } @@ -729,7 +729,7 @@ class IPTest extends PHPUnit_Framework_TestCase public function testPhpCompatInetNtop($k, $v) { $this->assertEquals($k, php_compat_inet_ntop(pack('H*', $v))); - if (!Piwik_Common::isWindows()) { + if (!Common::isWindows()) { $this->assertEquals($k, @inet_ntop(pack('H*', $v))); } } @@ -805,7 +805,7 @@ class IPTest extends PHPUnit_Framework_TestCase public function testPhpCompatInetPton($k, $v) { $this->assertEquals($v, bin2hex(php_compat_inet_pton($k))); - if (!Piwik_Common::isWindows()) { + if (!Common::isWindows()) { $this->assertEquals($v, bin2hex(@inet_pton($k))); } } diff --git a/tests/PHPUnit/Core/OptionTest.php b/tests/PHPUnit/Core/OptionTest.php index eafb246501..ea6bc19ef9 100644 --- a/tests/PHPUnit/Core/OptionTest.php +++ b/tests/PHPUnit/Core/OptionTest.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once "Option.php"; @@ -21,11 +21,11 @@ class OptionTest extends DatabaseTestCase $this->assertFalse(Piwik_Option::getInstance()->get('anonymous_defaultReport')); // populate table, expect '1' (i.e., found) - Piwik_Query("INSERT INTO " . Piwik_Common::prefixTable('option') . " VALUES ('anonymous_defaultReport', '1', false)"); + Piwik_Query("INSERT INTO " . Common::prefixTable('option') . " VALUES ('anonymous_defaultReport', '1', false)"); $this->assertSame('1', Piwik_Option::getInstance()->get('anonymous_defaultReport')); // delete row (bypassing API), expect '1' (i.e., from cache) - Piwik_Query("DELETE FROM " . Piwik_Common::prefixTable('option') . " WHERE option_name = ?", array('anonymous_defaultReport')); + Piwik_Query("DELETE FROM " . Common::prefixTable('option') . " WHERE option_name = ?", array('anonymous_defaultReport')); $this->assertSame('1', Piwik_Option::getInstance()->get('anonymous_defaultReport')); // force cache reload, expect false (i.e., not found) @@ -43,11 +43,11 @@ class OptionTest extends DatabaseTestCase $this->assertFalse(Piwik_GetOption('anonymous_defaultReport')); // populate table, expect '1' (i.e., found) - Piwik_Query("INSERT INTO " . Piwik_Common::prefixTable('option') . " VALUES ('anonymous_defaultReport', '1',true)"); + Piwik_Query("INSERT INTO " . Common::prefixTable('option') . " VALUES ('anonymous_defaultReport', '1',true)"); $this->assertSame('1', Piwik_GetOption('anonymous_defaultReport')); // delete row (bypassing API), expect '1' (i.e., from cache) - Piwik_Query("DELETE FROM " . Piwik_Common::prefixTable('option') . " WHERE option_name = ?", array('anonymous_defaultReport')); + Piwik_Query("DELETE FROM " . Common::prefixTable('option') . " WHERE option_name = ?", array('anonymous_defaultReport')); $this->assertSame('1', Piwik_GetOption('anonymous_defaultReport')); // force cache reload, expect false (i.e., not found) diff --git a/tests/PHPUnit/Core/ReleaseCheckListTest.php b/tests/PHPUnit/Core/ReleaseCheckListTest.php index e24f9cf144..d58cbfaea5 100644 --- a/tests/PHPUnit/Core/ReleaseCheckListTest.php +++ b/tests/PHPUnit/Core/ReleaseCheckListTest.php @@ -1,6 +1,6 @@ <?php use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -121,7 +121,7 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase */ public function testEndOfLines() { - if (Piwik_Common::isWindows()) { + if (Common::isWindows()) { // SVN native does not make this work on windows return; } diff --git a/tests/PHPUnit/Core/SegmentTest.php b/tests/PHPUnit/Core/SegmentTest.php index bbc8f4d70e..e86a0affdc 100644 --- a/tests/PHPUnit/Core/SegmentTest.php +++ b/tests/PHPUnit/Core/SegmentTest.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -62,8 +62,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase // OR, with 2 value rewrites array('referrerType==search,referrerType==direct', array( 'where' => ' (log_visit.referer_type = ? OR log_visit.referer_type = ? )', - 'bind' => array(Piwik_Common::REFERER_TYPE_SEARCH_ENGINE, - Piwik_Common::REFERER_TYPE_DIRECT_ENTRY))), + 'bind' => array(Common::REFERER_TYPE_SEARCH_ENGINE, + Common::REFERER_TYPE_DIRECT_ENTRY))), // IS NOT NULL array('browserCode==ff;referrerKeyword!=', array( @@ -103,7 +103,7 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT log_visit.idvisit FROM - ' . Piwik_Common::prefixTable('log_visit') . ' AS log_visit + ' . Common::prefixTable('log_visit') . ' AS log_visit WHERE ' . $expected['where'], 'bind' => $expected['bind'] @@ -142,7 +142,7 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_visit') . " AS log_visit + " . Common::prefixTable('log_visit') . " AS log_visit WHERE ( idsite = ? ) AND @@ -173,8 +173,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action - LEFT JOIN " . Piwik_Common::prefixTable('log_visit') . " AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit + " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action + LEFT JOIN " . Common::prefixTable('log_visit') . " AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit WHERE ( log_link_visit_action.idvisit = ? ) AND @@ -210,8 +210,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase log_visit.visit_total_actions, log_visit.visit_total_time FROM - " . Piwik_Common::prefixTable('log_visit') . " AS log_visit - LEFT JOIN " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_link_visit_action.idvisit = log_visit.idvisit + " . Common::prefixTable('log_visit') . " AS log_visit + LEFT JOIN " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_link_visit_action.idvisit = log_visit.idvisit WHERE ( log_visit.idvisit = ? ) AND @@ -244,8 +244,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action - LEFT JOIN " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite + " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action + LEFT JOIN " . Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite WHERE ( log_link_visit_action.idvisit = ? ) AND @@ -276,8 +276,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion - LEFT JOIN " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_conversion.idlink_va = log_link_visit_action.idlink_va + " . Common::prefixTable('log_conversion') . " AS log_conversion + LEFT JOIN " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_conversion.idlink_va = log_link_visit_action.idlink_va WHERE ( log_conversion.idvisit = ? ) AND @@ -312,8 +312,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT log_visit.* FROM - " . Piwik_Common::prefixTable('log_visit') . " AS log_visit - LEFT JOIN " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idvisit = log_visit.idvisit + " . Common::prefixTable('log_visit') . " AS log_visit + LEFT JOIN " . Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idvisit = log_visit.idvisit WHERE ( log_visit.idvisit = ? ) AND @@ -346,7 +346,7 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT log_conversion.* FROM - " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion + " . Common::prefixTable('log_conversion') . " AS log_conversion WHERE ( log_conversion.idvisit = ? ) AND @@ -377,8 +377,8 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion - LEFT JOIN " . Piwik_Common::prefixTable('log_visit') . " AS log_visit ON log_conversion.idvisit = log_visit.idvisit + " . Common::prefixTable('log_conversion') . " AS log_conversion + LEFT JOIN " . Common::prefixTable('log_visit') . " AS log_visit ON log_conversion.idvisit = log_visit.idvisit WHERE ( log_conversion.idvisit = ? ) AND @@ -412,9 +412,9 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT * FROM - " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action - LEFT JOIN " . Piwik_Common::prefixTable('log_visit') . " AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit - LEFT JOIN " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite + " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action + LEFT JOIN " . Common::prefixTable('log_visit') . " AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit + LEFT JOIN " . Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite WHERE HOUR(log_visit.visit_last_action_time) = ? AND log_conversion.idgoal = ? ", "bind" => array(12, 1)); @@ -450,9 +450,9 @@ class SegmentTest extends PHPUnit_Framework_TestCase SELECT log_visit.* FROM - " . Piwik_Common::prefixTable('log_visit') . " AS log_visit - LEFT JOIN " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_link_visit_action.idvisit = log_visit.idvisit - LEFT JOIN " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite + " . Common::prefixTable('log_visit') . " AS log_visit + LEFT JOIN " . Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action ON log_link_visit_action.idvisit = log_visit.idvisit + LEFT JOIN " . Common::prefixTable('log_conversion') . " AS log_conversion ON log_conversion.idlink_va = log_link_visit_action.idlink_va AND log_conversion.idsite = log_link_visit_action.idsite WHERE log_conversion.idgoal = ? AND HOUR(log_visit.visit_last_action_time) = ? AND log_link_visit_action.custom_var_k1 = ? GROUP BY log_visit.idvisit diff --git a/tests/PHPUnit/Core/ServeStaticFileTest.php b/tests/PHPUnit/Core/ServeStaticFileTest.php index 034a64a4ba..47747527f7 100644 --- a/tests/PHPUnit/Core/ServeStaticFileTest.php +++ b/tests/PHPUnit/Core/ServeStaticFileTest.php @@ -13,7 +13,7 @@ // This is Piwik logo, the static file used in this test suit use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; define("TEST_FILE_LOCATION", realpath(dirname(__FILE__) . "/../../resources/lipsum.txt")); define("TEST_FILE_CONTENT_TYPE", "text/plain"); @@ -101,7 +101,7 @@ class Test_Piwik_ServeStaticFile extends PHPUnit_Framework_TestCase * This test would fail on a windows environment because it is not possible to remove reading rights on a * windows file using PHP. */ - if (Piwik_Common::isWindows()) { + if (Common::isWindows()) { return; } diff --git a/tests/PHPUnit/Core/TranslationWriterTest.php b/tests/PHPUnit/Core/TranslationWriterTest.php index 187996ed0b..6b36c76dbf 100644 --- a/tests/PHPUnit/Core/TranslationWriterTest.php +++ b/tests/PHPUnit/Core/TranslationWriterTest.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -64,7 +64,7 @@ class TranslationWriterTest extends PHPUnit_Framework_TestCase */ public function testQuote($data, $expected) { - if (Piwik_Common::isWindows() && $data == "\n") { + if (Common::isWindows() && $data == "\n") { return; } $this->assertEquals($expected, Piwik_TranslationWriter::quote($data)); @@ -164,7 +164,7 @@ class TranslationWriterTest extends PHPUnit_Framework_TestCase $contents = file_get_contents($path); $expected = "<?php\n\$translations = array(\n\t'General_Locale' => 'en_CA.UTF-8',\n\t'General_Id' => 'Id',\n\t'Goals_Goals' => 'Goals',\n\n\t// FOR REVIEW\n\t'Plugin_Body' => 'Message\nBody',\n);\n"; - if (Piwik_Common::isWindows()) $expected = str_replace("\r\n", "\n", $expected); + if (Common::isWindows()) $expected = str_replace("\r\n", "\n", $expected); $this->assertEquals($expected, $contents); } } diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php index df3fd04f16..dfb515b713 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php'; @@ -87,7 +87,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts extends Test_Piwik foreach ($dashboards as $id => $layout) { $_GET['name'] = self::makeXssContent('dashboard name' . $id); - $_GET['layout'] = Piwik_Common::json_encode($layout); + $_GET['layout'] = Common::json_encode($layout); $_GET['idDashboard'] = $id + 1; Piwik_FrontController::getInstance()->fetchDispatch('Dashboard', 'saveLayout'); } @@ -117,7 +117,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogsWithXssAttempts extends Test_Piwik { $result = "<script>$('body').html('$type XSS!');</script>"; if ($sanitize) { - $result = Piwik_Common::sanitizeInputValue($result); + $result = Common::sanitizeInputValue($result); } return $result; } diff --git a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php index 92f495fac1..b8a4520456 100755 --- a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php +++ b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Tests some API using range periods & makes sure the correct amount of blob/numeric @@ -99,11 +99,11 @@ class Test_Piwik_Integration_OneVisitorOneWebsite_SeveralDaysDateRange_Archiving 'archive_numeric_2011_01' => 0, ); foreach ($tests as $table => $expectedRows) { - $sql = "SELECT count(*) FROM " . Piwik_Common::prefixTable($table) . " WHERE period = " . Piwik::$idPeriods['range']; + $sql = "SELECT count(*) FROM " . Common::prefixTable($table) . " WHERE period = " . Piwik::$idPeriods['range']; $countBlobs = Zend_Registry::get('db')->fetchOne($sql); if($expectedRows != $countBlobs) { - var_export(Zend_Registry::get('db')->fetchAll("SELECT * FROM " . Piwik_Common::prefixTable($table). " WHERE period = " . Piwik::$idPeriods['range'] . " ORDER BY idarchive ASC")); + var_export(Zend_Registry::get('db')->fetchAll("SELECT * FROM " . Common::prefixTable($table). " WHERE period = " . Piwik::$idPeriods['range'] . " ORDER BY idarchive ASC")); } $this->assertEquals($expectedRows, $countBlobs, "$table expected $expectedRows, got $countBlobs"); } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php index 3fd750022b..fa43ef7cea 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Tests use of custom variable segments. @@ -86,11 +86,11 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchVisitorTyp 'archive_numeric_2009_12' => (6 + 2 + 3) * 2, ); foreach ($tests as $table => $expectedRows) { - $sql = "SELECT count(*) FROM " . Piwik_Common::prefixTable($table); + $sql = "SELECT count(*) FROM " . Common::prefixTable($table); $countBlobs = Zend_Registry::get('db')->fetchOne($sql); if($expectedRows != $countBlobs) { - var_export(Zend_Registry::get('db')->fetchAll("SELECT * FROM " . Piwik_Common::prefixTable($table) . " ORDER BY name, idarchive ASC")); + var_export(Zend_Registry::get('db')->fetchAll("SELECT * FROM " . Common::prefixTable($table) . " ORDER BY name, idarchive ASC")); } $this->assertEquals($expectedRows, $countBlobs, "$table: %s"); } diff --git a/tests/PHPUnit/Integration/UrlNormalizationTest.php b/tests/PHPUnit/Integration/UrlNormalizationTest.php index a2b0e6c702..cf0237bcc3 100644 --- a/tests/PHPUnit/Integration/UrlNormalizationTest.php +++ b/tests/PHPUnit/Integration/UrlNormalizationTest.php @@ -1,5 +1,5 @@ <?php -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Tests the URL normalization. @@ -85,12 +85,12 @@ class Test_Piwik_Integration_UrlNormalization extends IntegrationTestCase */ public function testCheckPostConditions() { - $sql = "SELECT count(*) FROM " . Piwik_Common::prefixTable('log_action'); + $sql = "SELECT count(*) FROM " . Common::prefixTable('log_action'); $count = Zend_Registry::get('db')->fetchOne($sql); $expected = 9; // 4 urls + 5 titles $this->assertEquals($expected, $count, "only $expected actions expected"); - $sql = "SELECT name, url_prefix FROM " . Piwik_Common::prefixTable('log_action') + $sql = "SELECT name, url_prefix FROM " . Common::prefixTable('log_action') . " WHERE type = " . Piwik_Tracker_Action::TYPE_ACTION_URL . " ORDER BY idaction ASC"; $urls = Zend_Registry::get('db')->fetchAll($sql); diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index 86460d46d5..624efa9b55 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -7,7 +7,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php'; @@ -706,7 +706,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase && $isTestLogImportReverseChronological; $request = new Piwik_API_Request($requestUrl); - $dateTime = Piwik_Common::getRequestVar('date', '', 'string', Piwik_Common::getArrayFromQueryString($requestUrl)); + $dateTime = Common::getRequestVar('date', '', 'string', Common::getArrayFromQueryString($requestUrl)); list($processedFilePath, $expectedFilePath) = $this->getProcessedAndExpectedPaths($testName, $apiId); @@ -1089,7 +1089,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase $tableType = strpos($table, 'archive_numeric') !== false ? 'archive_numeric' : 'archive_blob'; $createSql = Piwik::getTableCreateSql($tableType); - $createSql = str_replace(Piwik_Common::prefixTable($tableType), $table, $createSql); + $createSql = str_replace(Common::prefixTable($tableType), $table, $createSql); Piwik_Query($createSql); } diff --git a/tests/PHPUnit/Plugins/LanguagesManagerTest.php b/tests/PHPUnit/Plugins/LanguagesManagerTest.php index 2b47a4bb80..2b0571460c 100755 --- a/tests/PHPUnit/Plugins/LanguagesManagerTest.php +++ b/tests/PHPUnit/Plugins/LanguagesManagerTest.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once 'LanguagesManager/API.php'; @@ -26,8 +26,8 @@ class Test_LanguagesManager extends PHPUnit_Framework_TestCase function getTestDataForLanguageFiles() { - self::$allLanguages = Piwik_Common::getLanguagesList(); - self::$allCountries = Piwik_Common::getCountriesList(); + self::$allLanguages = Common::getLanguagesList(); + self::$allCountries = Common::getCountriesList(); self::$englishStringsWithParameters = array(); self::$englishStringsIndexed = array(); self::$expectedLanguageKeys = array(); @@ -283,7 +283,7 @@ class Test_LanguagesManager extends PHPUnit_Framework_TestCase */ function testGetLanguagesList() { - $languages = Piwik_Common::getLanguagesList(); + $languages = Common::getLanguagesList(); $this->assertTrue(count($languages) > 0); foreach ($languages as $langCode => $langs) { $this->assertTrue(strlen($langCode) == 2, "$langCode length = 2"); diff --git a/tests/PHPUnit/Plugins/PrivacyManagerTest.php b/tests/PHPUnit/Plugins/PrivacyManagerTest.php index 2b81e55dad..3c8c32cd10 100755 --- a/tests/PHPUnit/Plugins/PrivacyManagerTest.php +++ b/tests/PHPUnit/Plugins/PrivacyManagerTest.php @@ -7,7 +7,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; require_once 'PrivacyManager/PrivacyManager.php'; @@ -110,7 +110,7 @@ class PrivacyManagerTest extends IntegrationTestCase Piwik_Tracker_Cache::deleteTrackerCache(); Piwik_DataAccess_ArchiveTableCreator::clear(); - $tempTableName = Piwik_Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME); + $tempTableName = Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME); Piwik_Query("DROP TABLE IF EXISTS " . $tempTableName); } @@ -182,12 +182,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => -1 + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => -1 ); $this->assertEquals($expectedPrediction, $prediction); @@ -300,12 +300,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => 1, // remove the garbage metric - Piwik_Common::prefixTable('archive_blob_2012_01') => -1 + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => 1, // remove the garbage metric + Common::prefixTable('archive_blob_2012_01') => -1 ); $this->assertEquals($expectedPrediction, $prediction); @@ -326,7 +326,7 @@ class PrivacyManagerTest extends IntegrationTestCase $this->assertEquals($janRowCount, $tableCount); // January if($janRowCount != $tableCount) { - var_export(Piwik_FetchAll("SELECT * FROM " . Piwik_Common::prefixTable($tableName) )); + var_export(Piwik_FetchAll("SELECT * FROM " . Common::prefixTable($tableName) )); } // check february numerics not deleted @@ -358,12 +358,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $unexplained = 0;//-2; $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 10 + $unexplained // removing 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports + 1 segmented report + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 10 + $unexplained // removing 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports + 1 segmented report ); $this->assertEquals($expectedPrediction, $prediction); @@ -395,12 +395,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $unexplained = 0;//-2; $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 11 + $unexplained // 5 days, 1 month & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 11 + $unexplained // 5 days, 1 month & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report ); $this->assertEquals($expectedPrediction, $prediction); @@ -432,12 +432,12 @@ class PrivacyManagerTest extends IntegrationTestCase $unexplained = 0;//-1; // perform checks on prediction $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks, 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks, 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report ); $this->assertEquals($expectedPrediction, $prediction); @@ -469,12 +469,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $unexplained = 0;//-1; $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 14 + $unexplained // 5 days, 4 weeks & 1 year to remove + 1 garbage report + 2 range reports + 1 segmented report ); $this->assertEquals($expectedPrediction, $prediction); @@ -501,7 +501,7 @@ class PrivacyManagerTest extends IntegrationTestCase $purger = Piwik_PrivacyManager_LogDataPurger::make($this->settings, true); $this->unusedIdAction = Piwik_FetchOne( - "SELECT idaction FROM " . Piwik_Common::prefixTable('log_action') . " WHERE name = ?", + "SELECT idaction FROM " . Common::prefixTable('log_action') . " WHERE name = ?", array('whatever.com/_40')); $this->assertTrue($this->unusedIdAction > 0); @@ -513,7 +513,7 @@ class PrivacyManagerTest extends IntegrationTestCase // check that the unused action still exists $count = Piwik_FetchOne( - "SELECT COUNT(*) FROM " . Piwik_Common::prefixTable('log_action') . " WHERE idaction = ?", + "SELECT COUNT(*) FROM " . Common::prefixTable('log_action') . " WHERE idaction = ?", array($this->unusedIdAction)); $this->assertEquals(1, $count); @@ -538,12 +538,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $unexplained = 0;//-2; $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 13 + $unexplained // 5 days, 4 weeks, 1 month & 1 year + 1 garbage report + 1 segmented report + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 13 + $unexplained // 5 days, 4 weeks, 1 month & 1 year + 1 garbage report + 1 segmented report ); $this->assertEquals($expectedPrediction, $prediction); @@ -576,12 +576,12 @@ class PrivacyManagerTest extends IntegrationTestCase // perform checks on prediction $unexplained = 0;//-2; $expectedPrediction = array( - Piwik_Common::prefixTable('log_conversion') => 6, - Piwik_Common::prefixTable('log_link_visit_action') => 6, - Piwik_Common::prefixTable('log_visit') => 3, - Piwik_Common::prefixTable('log_conversion_item') => 3, - Piwik_Common::prefixTable('archive_numeric_2012_01') => -1, - Piwik_Common::prefixTable('archive_blob_2012_01') => 9 + $unexplained // 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports + Common::prefixTable('log_conversion') => 6, + Common::prefixTable('log_link_visit_action') => 6, + Common::prefixTable('log_visit') => 3, + Common::prefixTable('log_conversion_item') => 3, + Common::prefixTable('archive_numeric_2012_01') => -1, + Common::prefixTable('archive_blob_2012_01') => 9 + $unexplained // 4 weeks, 1 month & 1 year + 1 garbage report + 2 range reports ); $this->assertEquals($expectedPrediction, $prediction); @@ -715,12 +715,12 @@ class PrivacyManagerTest extends IntegrationTestCase $archiveTables = self::_getArchiveTableNames(); foreach ($archiveTables['numeric'] as $table) { - $realTable = Piwik_Common::prefixTable($table); + $realTable = Common::prefixTable($table); $sql = "DELETE FROM $realTable WHERE name NOT IN ('" . implode("','", $metricsToSave) . "') AND name NOT LIKE 'done%'"; Piwik_Query($sql); } foreach ($archiveTables['blob'] as $table) { - $realTable = Piwik_Common::prefixTable($table); + $realTable = Common::prefixTable($table); Piwik_Query("DELETE FROM $realTable WHERE name NOT IN ('VisitorInterest_timeGap')"); } @@ -732,15 +732,15 @@ class PrivacyManagerTest extends IntegrationTestCase VALUES (10000,?,1,?,?,?,?,?)"; // one metric for jan & one for feb - Piwik_Query(sprintf($sql, Piwik_Common::prefixTable($archiveTables['numeric'][0])), + Piwik_Query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][0])), array(self::GARBAGE_FIELD, $janDate1, $janDate1, $janDate1, 1, 100)); - Piwik_Query(sprintf($sql, Piwik_Common::prefixTable($archiveTables['numeric'][1])), + Piwik_Query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][1])), array(self::GARBAGE_FIELD, $febDate1, $febDate1, $febDate1, 1, 200)); // add garbage reports - Piwik_Query(sprintf($sql, Piwik_Common::prefixTable($archiveTables['blob'][0])), + Piwik_Query(sprintf($sql, Common::prefixTable($archiveTables['blob'][0])), array(self::GARBAGE_FIELD, $janDate1, $janDate1, $janDate1, 10, 'blobval')); - Piwik_Query(sprintf($sql, Piwik_Common::prefixTable($archiveTables['blob'][1])), + Piwik_Query(sprintf($sql, Common::prefixTable($archiveTables['blob'][1])), array(self::GARBAGE_FIELD, $febDate1, $febDate1, $febDate1, 20, 'blobval')); } @@ -817,8 +817,8 @@ class PrivacyManagerTest extends IntegrationTestCase return; } - $tempTableName = Piwik_Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME); - $logLinkVisitActionTable = Piwik_Common::prefixTable("log_link_visit_action"); + $tempTableName = Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME); + $logLinkVisitActionTable = Common::prefixTable("log_link_visit_action"); $sql = "INSERT INTO $logLinkVisitActionTable (idsite, idvisitor, server_time, idvisit, idaction_url, idaction_url_ref, @@ -840,7 +840,7 @@ class PrivacyManagerTest extends IntegrationTestCase protected function _getTableCount($tableName, $where = '') { - $sql = "SELECT COUNT(*) FROM " . Piwik_Common::prefixTable($tableName) . " $where"; + $sql = "SELECT COUNT(*) FROM " . Common::prefixTable($tableName) . " $where"; return Piwik_FetchOne($sql); } @@ -849,7 +849,7 @@ class PrivacyManagerTest extends IntegrationTestCase $dbName = Config::getInstance()->database['dbname']; $sql = "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ?"; - return Piwik_FetchOne($sql, array($dbName, Piwik_Common::prefixTable($tableName))) == 1; + return Piwik_FetchOne($sql, array($dbName, Common::prefixTable($tableName))) == 1; } protected static function _getArchiveTableNames() diff --git a/tests/resources/staticFileServer.php b/tests/resources/staticFileServer.php index e0e2a00dc1..510e1794dc 100644 --- a/tests/resources/staticFileServer.php +++ b/tests/resources/staticFileServer.php @@ -10,7 +10,7 @@ * serveStaticFile.test.php has been created to avoid making too many modifications to /tests/core/Piwik.test.php */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__).'/../../'); if(file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) @@ -61,10 +61,10 @@ define("TEST_FILE_SRV_MODE", "testFile"); * the execution of Piwik:serveStaticFile(). In this case, unit tests won't be executed */ // Getting the server mode -$staticFileServerMode = Piwik_Common::getRequestVar(SRV_MODE_REQUEST_VAR, ""); +$staticFileServerMode = Common::getRequestVar(SRV_MODE_REQUEST_VAR, ""); // Setting zlib output compression as requested -ini_set('zlib.output_compression', Piwik_Common::getRequestVar(ZLIB_OUTPUT_REQUEST_VAR, '0')); +ini_set('zlib.output_compression', Common::getRequestVar(ZLIB_OUTPUT_REQUEST_VAR, '0')); if ($staticFileServerMode === "") { throw new Exception("When this testing file is used as a static file server, the request parameter " . |