diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-12-10 00:50:07 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-12-10 00:50:07 +0300 |
commit | ebced800c0184f5ce93663afab6b0337c3755cbb (patch) | |
tree | fb26c2506d37586ff0d38fb902d63d17701bd883 /tests | |
parent | 3d26af780d8fe0e4f7c5824a88b95c4a0d0d25d7 (diff) | |
parent | db36ca384809ea36457a465a3b6d1ecf951b0e26 (diff) |
Merge master into "3.0"
Conflicts:
.travis.yml
CHANGELOG.md
core/Plugin/ControllerAdmin.php
core/Version.php
core/testMinimumPhpVersion.php
plugins/API/API.php
plugins/Actions/Reports/GetPageUrls.php
plugins/AnonymousPiwikUsageMeasurement
plugins/CoreHome/CoreHome.php
plugins/CoreHome/templates/_menu.twig
plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml
plugins/Goals/Controller.php
tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
tests/PHPUnit/Integration/Plugin/ManagerTest.php
tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml
tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml
tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml
tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml
tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml
tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml
tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml
tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml
tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml
tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml
tests/UI/expected-ui-screenshots
tests/UI/specs/Overlay_spec.js
tests/UI/specs/UIIntegration_spec.js
Diffstat (limited to 'tests')
123 files changed, 3057 insertions, 629 deletions
diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php index b516c85d65..227e45bd4a 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php @@ -57,6 +57,11 @@ class ManySitesImportedLogsWithXssAttempts extends ManySitesImportedLogs self::createWebsite($this->dateTime, $ecommerce = 0, $siteName = 'Piwik test two', $siteUrl = 'http://example-site-two.com'); } + + if (!self::siteCreated($idSite = 3)) { + self::createWebsite($this->dateTime, $ecommerce = 0, $siteName = 'Piwik test three', + $siteUrl = 'http://example-site-three.com'); + } } public function addAnnotations() diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php index 9db794269d..ce454b38d2 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php @@ -265,9 +265,6 @@ class ManyVisitsWithGeoIP extends Fixture public static function unsetLocationProvider() { - // also fails on other PHP, is it really needed? - return; - try { LocationProvider::setCurrentProvider('default'); } catch(Exception $e) { diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php index dd2a2c773c..9fbd6f986d 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php @@ -33,6 +33,8 @@ class ManyVisitsWithMockLocationProvider extends Fixture $this->setUpWebsitesAndGoals(); $this->setMockLocationProvider(); $this->trackVisits(); + + ManyVisitsWithGeoIP::unsetLocationProvider(); } public function tearDown() diff --git a/tests/PHPUnit/Fixtures/OmniFixture.php b/tests/PHPUnit/Fixtures/OmniFixture.php index dd680e9085..cd6fc0fb34 100644 --- a/tests/PHPUnit/Fixtures/OmniFixture.php +++ b/tests/PHPUnit/Fixtures/OmniFixture.php @@ -32,11 +32,29 @@ class OmniFixture extends Fixture public $fixtures = array(); + private function requireAllFixtures() + { + $fixturesToLoad = array( + '/tests/PHPUnit/Fixtures/*.php', + '/tests/UI/Fixtures/*.php', + '/plugins/*/tests/Fixtures/*.php', + '/plugins/*/Test/Fixtures/*.php', + ); + + foreach($fixturesToLoad as $fixturePath) { + foreach (glob(PIWIK_INCLUDE_PATH . $fixturePath) as $file) { + require_once $file; + } + } + } + /** * Constructor. */ public function __construct() { + $this->requireAllFixtures(); + $date = $this->month . '-01'; $classes = get_declared_classes(); @@ -97,6 +115,8 @@ class OmniFixture extends Fixture public function setUp() { foreach ($this->fixtures as $fixture) { + echo "Setting up " . get_class($fixture) . "...\n"; + $fixture->setUp(); } @@ -111,6 +131,8 @@ class OmniFixture extends Fixture public function tearDown() { foreach ($this->fixtures as $fixture) { + echo "Tearing down " . get_class($fixture) . "...\n"; + $fixture->tearDown(); } } diff --git a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php index 8ba755fabd..a32129c93b 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php @@ -36,10 +36,9 @@ class SomeVisitsCustomVariablesCampaignsNotHeuristics extends Fixture private function setPiwikEnvironmentOverrides() { - $configOverride = $this->getTestEnvironment()->configOverride; - $configOverride['Tracker']['create_new_visit_when_website_referrer_changes'] = 1; - $this->getTestEnvironment()->configOverride = $configOverride; - $this->getTestEnvironment()->save(); + $env = $this->getTestEnvironment(); + $env->overrideConfig('Tracker', 'create_new_visit_when_website_referrer_changes', 1); + $env->save(); } private function setUpWebsitesAndGoals() diff --git a/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php b/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php index 8983d1eea5..d2740b8aba 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php +++ b/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php @@ -23,7 +23,7 @@ class TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers extends Fixture public $keywords = array( 'free > proprietary', // testing a keyword containing > 'peace "," not war', // testing a keyword containing , - 'justice )(&^#%$ NOT corruption!', + 'justice )(&^#%$ NOT \'" corruption!', ); public function setUp() diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php index 93ae92a6dd..623e7e388d 100644 --- a/tests/PHPUnit/Fixtures/UITestFixture.php +++ b/tests/PHPUnit/Fixtures/UITestFixture.php @@ -24,6 +24,7 @@ use Piwik\Plugins\UsersManager\API as UsersManagerAPI; use Piwik\Plugins\SitesManager\API as SitesManagerAPI; use Piwik\Tests\Framework\Fixture; use Piwik\Plugins\VisitsSummary\API as VisitsSummaryAPI; +use Piwik\Config as PiwikConfig; /** * Fixture for UI tests. @@ -44,7 +45,9 @@ class UITestFixture extends SqlDump parent::setUp(); + self::resetPluginsInstalledConfig(); self::updateDatabase(); + self::installAndActivatePlugins($this->getTestEnvironment()); // make sure site has an early enough creation date (for period selector tests) Db::get()->update(Common::prefixTable("site"), diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index acd2f5c9f4..f421ba5658 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -107,6 +107,7 @@ class Fixture extends \PHPUnit_Framework_Assert public $testCaseClass = false; public $extraPluginsToLoad = array(); + public $extraDiEnvironments = array(); public $testEnvironment = null; @@ -141,6 +142,11 @@ class Fixture extends \PHPUnit_Framework_Assert return 'python'; } + public static function getTestRootUrl() + { + return self::getRootUrl() . 'tests/PHPUnit/proxy/'; + } + public function loginAsSuperUser() { /** @var Auth $auth */ @@ -175,7 +181,7 @@ class Fixture extends \PHPUnit_Framework_Assert return $id; } - return Config::getInstance()->database_tests['dbname']; + return self::getConfig()->database_tests['dbname']; } public function performSetUp($setupEnvironmentOnly = false) @@ -196,6 +202,7 @@ class Fixture extends \PHPUnit_Framework_Assert $testEnv->testCaseClass = $this->testCaseClass; $testEnv->fixtureClass = get_class($this); $testEnv->dbName = $this->dbName; + $testEnv->extraDiEnvironments = $this->extraDiEnvironments; foreach ($this->extraTestEnvVars as $name => $value) { $testEnv->$name = $value; @@ -206,7 +213,7 @@ class Fixture extends \PHPUnit_Framework_Assert $this->createEnvironmentInstance(); if ($this->dbName === false) { // must be after test config is created - $this->dbName = Config::getInstance()->database['dbname']; + $this->dbName = self::getConfig()->database['dbname']; } try { @@ -223,21 +230,19 @@ class Fixture extends \PHPUnit_Framework_Assert Tracker::disconnectCachedDbConnection(); // reconnect once we're sure the database exists - Config::getInstance()->database['dbname'] = $this->dbName; + self::getConfig()->database['dbname'] = $this->dbName; Db::createDatabaseObject(); Db::get()->query("SET wait_timeout=28800;"); DbHelper::createTables(); - Manager::getInstance()->unloadPlugins(); + self::getPluginManager()->unloadPlugins(); } catch (Exception $e) { static::fail("TEST INITIALIZATION FAILED: " . $e->getMessage() . "\n" . $e->getTraceAsString()); } - include "DataFiles/SearchEngines.php"; - include "DataFiles/Socials.php"; include "DataFiles/Providers.php"; if (!$this->isFixtureSetUp()) { @@ -249,11 +254,12 @@ class Fixture extends \PHPUnit_Framework_Assert Cache::deleteTrackerCache(); - static::loadAllPlugins($this->getTestEnvironment(), $this->testCaseClass, $this->extraPluginsToLoad); + self::resetPluginsInstalledConfig(); + $testEnvironment = $this->getTestEnvironment(); + static::loadAllPlugins($testEnvironment, $this->testCaseClass, $this->extraPluginsToLoad); self::updateDatabase(); - - self::installAndActivatePlugins(); + self::installAndActivatePlugins($testEnvironment); $_GET = $_REQUEST = array(); $_SERVER['HTTP_REFERER'] = ''; @@ -277,7 +283,7 @@ class Fixture extends \PHPUnit_Framework_Assert APILanguageManager::getInstance()->setLanguageForUser('superUserLogin', 'en'); } - SettingsPiwik::overwritePiwikUrl(self::getRootUrl() . 'tests/PHPUnit/proxy/'); + SettingsPiwik::overwritePiwikUrl(self::getTestRootUrl()); if ($setupEnvironmentOnly) { return; @@ -359,10 +365,26 @@ class Fixture extends \PHPUnit_Framework_Assert $_GET = $_REQUEST = array(); Translate::reset(); - Config::getInstance()->Plugins; // make sure Plugins exists in a config object for next tests that use Plugin\Manager + self::getConfig()->Plugins; // make sure Plugins exists in a config object for next tests that use Plugin\Manager // since Plugin\Manager uses getFromGlobalConfig which doesn't init the config object } + protected static function resetPluginsInstalledConfig() + { + $config = self::getConfig(); + $installed = $config->PluginsInstalled; + $installed['PluginsInstalled'] = array(); + $config->PluginsInstalled = $installed; + } + + protected static function rememberCurrentlyInstalledPluginsAcrossRequests(TestingEnvironmentVariables $testEnvironment) + { + $plugins = self::getPluginManager()->getInstalledPluginsName(); + + $testEnvironment->overrideConfig('PluginsInstalled', 'PluginsInstalled', $plugins); + $testEnvironment->save(); + } + /** * @param \Piwik\Tests\Framework\TestingEnvironmentVariables|null $testEnvironment Ignored. * @param bool|false $testCaseClass Ignored. @@ -371,12 +393,12 @@ class Fixture extends \PHPUnit_Framework_Assert public static function loadAllPlugins(TestingEnvironmentVariables $testEnvironment = null, $testCaseClass = false, $extraPluginsToLoad = array()) { DbHelper::createTables(); - Plugin\Manager::getInstance()->loadActivatedPlugins(); + self::getPluginManager()->loadActivatedPlugins(); } - public static function installAndActivatePlugins() + public static function installAndActivatePlugins(TestingEnvironmentVariables $testEnvironment) { - $pluginsManager = Manager::getInstance(); + $pluginsManager = self::getPluginManager(); // Install plugins $messages = $pluginsManager->installLoadedPlugins(); @@ -393,19 +415,35 @@ class Fixture extends \PHPUnit_Framework_Assert } $pluginsManager->loadPluginTranslations(); + + self::rememberCurrentlyInstalledPluginsAcrossRequests($testEnvironment); + } + + private static function getPluginManager() + { + return Manager::getInstance(); + } + + private static function getConfig() + { + return Config::getInstance(); } public static function unloadAllPlugins() { try { - $manager = Manager::getInstance(); + $manager = self::getPluginManager(); $plugins = $manager->getLoadedPlugins(); foreach ($plugins as $plugin) { $plugin->uninstall(); } - Manager::getInstance()->unloadPlugins(); + + $manager->unloadPlugins(); } catch (Exception $e) { } + + self::resetPluginsInstalledConfig(); + self::rememberCurrentlyInstalledPluginsAcrossRequests(new TestingEnvironmentVariables()); } /** @@ -455,6 +493,7 @@ class Fixture extends \PHPUnit_Framework_Assert // Clear the memory Website cache Site::clearCache(); + Cache::deleteCacheWebsiteAttributes($idSite); return $idSite; } @@ -466,13 +505,19 @@ class Fixture extends \PHPUnit_Framework_Assert */ public static function getRootUrl() { - $piwikUrl = Config::getInstance()->tests['http_host']; - $piwikUri = Config::getInstance()->tests['request_uri']; + $config = self::getConfig(); + $piwikUrl = $config->tests['http_host']; + $piwikUri = $config->tests['request_uri']; + $piwikPort = $config->tests['port']; if($piwikUri == '@REQUEST_URI@') { throw new Exception("Piwik is mis-configured. Remove (or fix) the 'request_uri' entry below [tests] section in your config.ini.php. "); } + if (!empty($piwikPort)) { + $piwikUrl = $piwikUrl . ':' . $piwikPort; + } + if (strpos($piwikUrl, 'http://') !== 0) { $piwikUrl = 'http://' . $piwikUrl . '/'; } @@ -508,7 +553,7 @@ class Fixture extends \PHPUnit_Framework_Assert */ public static function getTrackerUrl() { - return self::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php'; + return self::getTestRootUrl() . 'piwik.php'; } /** @@ -815,7 +860,7 @@ class Fixture extends \PHPUnit_Framework_Assert $cmd = $python . ' "' . PIWIK_INCLUDE_PATH . '/misc/log-analytics/import_logs.py" ' # script loc . '-ddd ' // debug - . '--url="' . self::getRootUrl() . 'tests/PHPUnit/proxy/" ' # proxy so that piwik uses test config files + . '--url="' . self::getTestRootUrl() . '" ' # proxy so that piwik uses test config files ; foreach ($options as $name => $values) { @@ -860,7 +905,7 @@ class Fixture extends \PHPUnit_Framework_Assert */ public static function connectWithoutDatabase() { - $dbConfig = Config::getInstance()->database; + $dbConfig = self::getConfig()->database; $oldDbName = $dbConfig['dbname']; $dbConfig['dbname'] = null; @@ -878,7 +923,7 @@ class Fixture extends \PHPUnit_Framework_Assert public function dropDatabase($dbName = null) { - $dbName = $dbName ?: $this->dbName ?: Config::getInstance()->database_tests['dbname']; + $dbName = $dbName ?: $this->dbName ?: self::getConfig()->database_tests['dbname']; $this->log("Dropping database '$dbName'..."); diff --git a/tests/PHPUnit/Framework/Mock/LocationProvider.php b/tests/PHPUnit/Framework/Mock/LocationProvider.php index 545f71130e..3423c53a7b 100755 --- a/tests/PHPUnit/Framework/Mock/LocationProvider.php +++ b/tests/PHPUnit/Framework/Mock/LocationProvider.php @@ -27,6 +27,11 @@ class LocationProvider extends CountryLocationProvider if (isset($this->ipToLocations[$ip])) { $result = $this->ipToLocations[$ip]; } else { + if (!isset(self::$locations[$this->currentLocation])) { + throw new \Exception("Unknown location index in mock LocationProvider {$this->currentLocation}. This " + . "shouldn't ever happen, it is likely something is using the mock LocationProvider when it should be using a real one."); + } + $result = self::$locations[$this->currentLocation]; $this->currentLocation = ($this->currentLocation + 1) % count(self::$locations); diff --git a/tests/PHPUnit/Framework/TestRequest/Response.php b/tests/PHPUnit/Framework/TestRequest/Response.php index 6d729ca941..8a3ed5d39e 100644 --- a/tests/PHPUnit/Framework/TestRequest/Response.php +++ b/tests/PHPUnit/Framework/TestRequest/Response.php @@ -11,6 +11,7 @@ namespace Piwik\Tests\Framework\TestRequest; use Piwik\API\Request; use PHPUnit_Framework_Assert as Asserts; use Exception; +use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\TestCase\SystemTestCase; /** @@ -114,6 +115,7 @@ class Response $apiResponse = $this->normalizeDecimalFields($apiResponse); $apiResponse = $this->normalizeEncodingPhp533($apiResponse); $apiResponse = $this->normalizeSpaces($apiResponse); + $apiResponse = $this->replacePiwikUrl($apiResponse); return $apiResponse; } @@ -258,4 +260,18 @@ class Response { return $this->removeXmlFields($apiResponse, array('idsubdatatable_in_db')); } + + /** + * To allow tests to pass no matter what port Piwik is on, we replace the test URL w/ another + * one in the response. We don't remove the URL outright, because then we would not be able + * to detect regressions where the root URL went missing. + * + * @param $apiResponse + * @return mixed + * @throws Exception + */ + private function replacePiwikUrl($apiResponse) + { + return str_replace(Fixture::getRootUrl(), "http://example.com/piwik/", $apiResponse); + } } diff --git a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php index be1c17f959..df6a011af5 100644 --- a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php +++ b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php @@ -190,7 +190,12 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator public function getExtraEnvironments() { - return array('test'); + $result = array('test'); + + $extraEnvironments = $this->vars->extraDiEnvironments ?: array(); + $result = array_merge($result, $extraEnvironments); + + return $result; } private function getPluginsToLoadDuringTest() @@ -234,4 +239,4 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator . "Is the namespace correct? Is the file in the correct folder?"); } } -}
\ No newline at end of file +} diff --git a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php index 4b33a7fe07..60942d2510 100644 --- a/tests/PHPUnit/Framework/TestingEnvironmentVariables.php +++ b/tests/PHPUnit/Framework/TestingEnvironmentVariables.php @@ -39,6 +39,45 @@ class TestingEnvironmentVariables return isset($this->behaviorOverrideProperties[$name]); } + /** + * Overrides a config entry. + * + * You can use this method either to set one specific config value `overrideConfig(group, name, value)` + * or you can set a whole group of values `overrideConfig(group, valueObject)`. + * + * @param string $group Eg 'General', 'log', or any other config group name + * @param string|array $name The name of the config within the group you want to overwrite. If you want to overwrite + * the whole group just leave `$value` empty and instead provide an array of key/value pairs + * here. + * @param string|int|array|null $value The value you want to set for the given config. + * @throws \Exception if no name is set + */ + public function overrideConfig($group, $name, $value = null) + { + if (empty($name) && !is_array($name)) { + throw new \Exception('No name set that needs to be overwritten'); + } + + $config = $this->configOverride; + + if (empty($config)) { + $config = array(); + } + + if (!isset($value) && is_array($name)) { + $config[$group] = $name; + $this->configOverride = $config; + return; + } + + if (!isset($config[$group])) { + $config[$group] = array(); + } + + $config[$group][$name] = $value; + $this->configOverride = $config; + } + public function save() { $includePath = __DIR__ . '/../../..'; diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php index c21a277061..9a5595e29a 100644 --- a/tests/PHPUnit/Integration/DbTest.php +++ b/tests/PHPUnit/Integration/DbTest.php @@ -52,7 +52,7 @@ class DbTest extends IntegrationTestCase $this->assertInstanceOf($expectedClass, $db); $result = $db->fetchOne('SELECT @@SESSION.sql_mode'); - $expected = 'NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'; + $expected = 'NO_AUTO_VALUE_ON_ZERO'; $this->assertSame($expected, $result); } diff --git a/tests/PHPUnit/Integration/Plugin/ManagerTest.php b/tests/PHPUnit/Integration/Plugin/ManagerTest.php index 924edecf00..e05e3a021e 100644 --- a/tests/PHPUnit/Integration/Plugin/ManagerTest.php +++ b/tests/PHPUnit/Integration/Plugin/ManagerTest.php @@ -15,6 +15,7 @@ use Piwik\Plugin; use Piwik\Settings\Storage; use Piwik\Cache as PiwikCache; use Piwik\Tests\Integration\Settings\IntegrationTestCase; +use Piwik\Widget\WidgetsList; /** * @group Plugin @@ -96,7 +97,7 @@ class ManagerTest extends IntegrationTestCase list($controller, $module, $action) = explode('.', $hook); try { - $resolver = new ControllerResolver(StaticContainer::getContainer()); + $resolver = new ControllerResolver(StaticContainer::getContainer(), new Plugin\Widgets($this->manager)); $params = array(); $controller = $resolver->getController($module, $action, $params); } catch (\Exception $e) { @@ -109,6 +110,36 @@ class ManagerTest extends IntegrationTestCase } } + /** + * @dataProvider getPluginNameProvider + */ + public function test_isValidPluginName($expectedIsValid, $pluginName) + { + $valid = $this->manager->isValidPluginName($pluginName); + $this->assertSame($expectedIsValid, $valid); + } + + public function getPluginNameProvider() + { + return array( + array(true, 'a'), + array(true, 'a0'), + array(true, 'pluginNameTest'), + array(true, 'PluginNameTest'), + array(true, 'PluginNameTest92323232eerwrwere938'), + array(false, ''), + array(false, '0'), + array(false, '0a'), + array(false, 'a.'), + array(false, 'a-'), + array(false, 'a_'), + array(false, 'a-ererer'), + array(false, 'a_ererer'), + array(false, '..'), + array(false, '/'), + ); + } + private function getCacheForTrackerPlugins() { return PiwikCache::getEagerCache(); diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php index b33a7c1949..58970199f0 100644 --- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php +++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php @@ -528,35 +528,35 @@ class ReleaseCheckListTest extends \PHPUnit_Framework_TestCase 'vendor/mnapoli/php-di/website', 'vendor/mnapoli/php-di/news', 'vendor/mnapoli/php-di/doc', - 'vendor/tecnick.com/tcpdf/examples', - 'vendor/tecnick.com/tcpdf/CHANGELOG.txt', + 'vendor/tecnickcom/tcpdf/examples', + 'vendor/tecnickcom/tcpdf/CHANGELOG.txt', 'vendor/guzzle/guzzle/docs/', // deleted fonts folders - 'vendor/tecnick.com/tcpdf/fonts/ae_fonts_2.0', - 'vendor/tecnick.com/tcpdf/fonts/dejavu-fonts-ttf-2.33', - 'vendor/tecnick.com/tcpdf/fonts/dejavu-fonts-ttf-2.34', - 'vendor/tecnick.com/tcpdf/fonts/freefont-20100919', - 'vendor/tecnick.com/tcpdf/fonts/freefont-20120503', + 'vendor/tecnickcom/tcpdf/fonts/ae_fonts_2.0', + 'vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.33', + 'vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.34', + 'vendor/tecnickcom/tcpdf/fonts/freefont-20100919', + 'vendor/tecnickcom/tcpdf/fonts/freefont-20120503', // In the package script, there is a trailing * so any font matching will be deleted - 'vendor/tecnick.com/tcpdf/fonts/freemon', - 'vendor/tecnick.com/tcpdf/fonts/cid', - 'vendor/tecnick.com/tcpdf/fonts/courier', - 'vendor/tecnick.com/tcpdf/fonts/aefurat', - 'vendor/tecnick.com/tcpdf/fonts/dejavusansb', - 'vendor/tecnick.com/tcpdf/fonts/dejavusansi', - 'vendor/tecnick.com/tcpdf/fonts/dejavusansmono', - 'vendor/tecnick.com/tcpdf/fonts/dejavusanscondensed', - 'vendor/tecnick.com/tcpdf/fonts/dejavusansextralight', - 'vendor/tecnick.com/tcpdf/fonts/dejavuserif', - 'vendor/tecnick.com/tcpdf/fonts/freesansi', - 'vendor/tecnick.com/tcpdf/fonts/freesansb', - 'vendor/tecnick.com/tcpdf/fonts/freeserifb', - 'vendor/tecnick.com/tcpdf/fonts/freeserifi', - 'vendor/tecnick.com/tcpdf/fonts/pdf', - 'vendor/tecnick.com/tcpdf/fonts/times', - 'vendor/tecnick.com/tcpdf/fonts/uni2cid', + 'vendor/tecnickcom/tcpdf/fonts/freemon', + 'vendor/tecnickcom/tcpdf/fonts/cid', + 'vendor/tecnickcom/tcpdf/fonts/courier', + 'vendor/tecnickcom/tcpdf/fonts/aefurat', + 'vendor/tecnickcom/tcpdf/fonts/dejavusansb', + 'vendor/tecnickcom/tcpdf/fonts/dejavusansi', + 'vendor/tecnickcom/tcpdf/fonts/dejavusansmono', + 'vendor/tecnickcom/tcpdf/fonts/dejavusanscondensed', + 'vendor/tecnickcom/tcpdf/fonts/dejavusansextralight', + 'vendor/tecnickcom/tcpdf/fonts/dejavuserif', + 'vendor/tecnickcom/tcpdf/fonts/freesansi', + 'vendor/tecnickcom/tcpdf/fonts/freesansb', + 'vendor/tecnickcom/tcpdf/fonts/freeserifb', + 'vendor/tecnickcom/tcpdf/fonts/freeserifi', + 'vendor/tecnickcom/tcpdf/fonts/pdf', + 'vendor/tecnickcom/tcpdf/fonts/times', + 'vendor/tecnickcom/tcpdf/fonts/uni2cid', ); return $this->isFilePathFoundInArray($file, $filesDeletedFromPackage); diff --git a/tests/PHPUnit/Integration/ReportTest.php b/tests/PHPUnit/Integration/ReportTest.php index 3475cee9cf..036516bd91 100644 --- a/tests/PHPUnit/Integration/ReportTest.php +++ b/tests/PHPUnit/Integration/ReportTest.php @@ -364,7 +364,8 @@ class ReportTest extends IntegrationTestCase 'format' => 'original', 'module' => 'API', 'method' => 'ExampleReport.getExampleReport', - 'format_metrics' => 'bc' + 'format_metrics' => 'bc', + 'serialize' => '0' ) )->willReturn("result"); Proxy::setSingletonInstance($proxyMock); @@ -387,7 +388,8 @@ class ReportTest extends IntegrationTestCase 'format' => 'original', 'module' => 'API', 'method' => 'Referrers.getSearchEnginesFromKeywordId', - 'format_metrics' => 'bc' + 'format_metrics' => 'bc', + 'serialize' => '0' ) )->willReturn("result"); Proxy::setSingletonInstance($proxyMock); diff --git a/tests/PHPUnit/Integration/SegmentTest.php b/tests/PHPUnit/Integration/SegmentTest.php index 9179c6d61a..eccd355ee3 100644 --- a/tests/PHPUnit/Integration/SegmentTest.php +++ b/tests/PHPUnit/Integration/SegmentTest.php @@ -94,8 +94,7 @@ class SegmentTest extends IntegrationTestCase // test multiple column segments array('customVariableName==abc;customVariableValue==def', array( - 'where' => ' ((log_visit.custom_var_k1 = ?) OR (log_visit.custom_var_k2 = ?) OR (log_visit.custom_var_k3 = ?) OR (log_visit.custom_var_k4 = ?) OR (log_visit.custom_var_k5 = ?))' - . ' AND ((log_visit.custom_var_v1 = ?) OR (log_visit.custom_var_v2 = ?) OR (log_visit.custom_var_v3 = ?) OR (log_visit.custom_var_v4 = ?) OR (log_visit.custom_var_v5 = ?)) ', + 'where' => ' (log_visit.custom_var_k1 = ? OR log_visit.custom_var_k2 = ? OR log_visit.custom_var_k3 = ? OR log_visit.custom_var_k4 = ? OR log_visit.custom_var_k5 = ?) AND (log_visit.custom_var_v1 = ? OR log_visit.custom_var_v2 = ? OR log_visit.custom_var_v3 = ? OR log_visit.custom_var_v4 = ? OR log_visit.custom_var_v5 = ? )', 'bind' => array( 'abc', 'abc', 'abc', 'abc', 'abc', 'def', 'def', 'def', 'def', 'def', @@ -162,7 +161,7 @@ class SegmentTest extends IntegrationTestCase $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); } - public function test_getSelectQuery_whenJoinVisitOnAction() + public function test_getSelectQuery_whenJoinVisitOnLogLinkVisitAction() { $select = '*'; $from = 'log_link_visit_action'; @@ -226,7 +225,7 @@ class SegmentTest extends IntegrationTestCase $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); } - public function test_getSelectQuery_whenJoinConversionOnAction() + public function test_getSelectQuery_whenJoinConversionOnLogLinkVisitAction() { $select = '*'; $from = 'log_link_visit_action'; @@ -372,11 +371,106 @@ class SegmentTest extends IntegrationTestCase $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); } + public function test_getSelectQuery_whenJoinLogLinkVisitActionOnActionOnVisit_WithSameTableAlias() + { + $actionType = 3; + $idSite = 1; + $select = 'log_link_visit_action.custom_dimension_1, + log_action.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6`'; + $from = array( + 'log_link_visit_action', + array('table' => 'log_visit', 'joinOn' => 'log_visit.idvisit = log_link_visit_action.idvisit'), + array('table' => 'log_action', 'joinOn' => 'log_link_visit_action.idaction_url = log_action.idaction'), + 'log_visit' + ); + $where = 'log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ?'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logVisitTable = Common::prefixTable('log_visit'); + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT log_link_visit_action.custom_dimension_1, + log_action.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6` + FROM $logLinkVisitActionTable AS log_link_visit_action + LEFT JOIN $logVisitTable AS log_visit + ON log_visit.idvisit = log_link_visit_action.idvisit + LEFT JOIN $logActionTable AS log_action + ON log_link_visit_action.idaction_url = log_action.idaction + WHERE ( log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ? ) + AND ( log_action.type = ? )", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenJoinLogLinkVisitActionOnActionOnVisit_WithSameTableAliasButDifferentJoin() + { + $actionType = 3; + $idSite = 1; + $select = 'log_link_visit_action.custom_dimension_1, + log_action.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6`'; + $from = array( + 'log_link_visit_action', + array('table' => 'log_visit', 'joinOn' => 'log_visit.idvisit = log_link_visit_action.idvisit'), + array('table' => 'log_action', 'joinOn' => 'log_link_visit_action.idaction_name = log_action.idaction') + ); + $where = 'log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ?'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logVisitTable = Common::prefixTable('log_visit'); + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT log_link_visit_action.custom_dimension_1, + log_action.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6` + FROM $logLinkVisitActionTable AS log_link_visit_action + LEFT JOIN $logVisitTable AS log_visit + ON log_visit.idvisit = log_link_visit_action.idvisit + LEFT JOIN $logActionTable AS log_action + ON (log_link_visit_action.idaction_name = log_action.idaction AND log_link_visit_action.idaction_url = log_action.idaction) + WHERE ( log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ? ) + AND ( log_action.type = ? )", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + /** * visit is joined on action, then conversion is joined * make sure that conversion is joined on action not visit */ - public function test_getSelectQuery_whenJoinVisitAndConversionOnAction() + public function test_getSelectQuery_whenJoinVisitAndConversionOnLogLinkVisitAction() { $select = '*'; $from = 'log_link_visit_action'; @@ -446,7 +540,201 @@ class SegmentTest extends IntegrationTestCase $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); } - public function test_getSelectQuery_whenJoinConversionOnAction_segmentUsesPageUrl() + public function test_getSelectQuery_whenJoinVisitOnAction() + { + $actionType = 3; + $idSite = 1; + $select = 'count(distinct log_visit.idvisitor) AS `1`, + count(*) AS `2`, + sum(log_visit.visit_total_actions) AS `3`'; + $from = 'log_visit'; + $where = 'log_visit.visit_last_action_time >= ? + AND log_visit.visit_last_action_time <= ? + AND log_visit.idsite IN (?)'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logVisitTable = Common::prefixTable('log_visit'); + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT count(distinct log_inner.idvisitor) AS `1`, count(*) AS `2`, sum(log_inner.visit_total_actions) AS `3` FROM ( SELECT log_visit.idvisitor, log_visit.visit_total_actions + FROM $logVisitTable AS log_visit + LEFT JOIN $logLinkVisitActionTable AS log_link_visit_action + ON log_link_visit_action.idvisit = log_visit.idvisit + LEFT JOIN $logActionTable AS log_action + ON log_link_visit_action.idaction_url = log_action.idaction + WHERE ( log_visit.visit_last_action_time >= ? + AND log_visit.visit_last_action_time <= ? + AND log_visit.idsite IN (?) ) + AND ( log_action.type = ? ) + GROUP BY log_visit.idvisit + ORDER BY NULL ) AS log_inner", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenJoinLogLinkVisitActionOnActionOnVisit() + { + $actionType = 3; + $idSite = 1; + $select = 'log_link_visit_action.custom_dimension_1, + actionAlias.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case visitAlias.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6`'; + $from = array( + 'log_link_visit_action', + array('table' => 'log_visit', 'tableAlias' => 'visitAlias', 'joinOn' => 'visitAlias.idvisit = log_link_visit_action.idvisit'), + array('table' => 'log_action', 'tableAlias' => 'actionAlias', 'joinOn' => 'log_link_visit_action.idaction_url = actionAlias.idaction') + ); + $where = 'log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ?'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logVisitTable = Common::prefixTable('log_visit'); + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT log_link_visit_action.custom_dimension_1, + actionAlias.name as url, + sum(log_link_visit_action.time_spent) as `13`, + sum(case visitAlias.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `6` + FROM $logLinkVisitActionTable AS log_link_visit_action + LEFT JOIN $logVisitTable AS visitAlias + ON visitAlias.idvisit = log_link_visit_action.idvisit + LEFT JOIN $logActionTable AS actionAlias + ON log_link_visit_action.idaction_url = actionAlias.idaction + LEFT JOIN $logActionTable AS log_action + ON log_link_visit_action.idaction_url = log_action.idaction + WHERE ( log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ? ) + AND ( log_action.type = ? )", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenJoinLogLinkVisitActionOnAction() + { + $actionType = 3; + $idSite = 1; + $select = 'log_link_visit_action.custom_dimension_1, + sum(log_link_visit_action.time_spent) as `13`'; + $from = 'log_link_visit_action'; + $where = 'log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ?'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT log_link_visit_action.custom_dimension_1, sum(log_link_visit_action.time_spent) as `13` + FROM $logLinkVisitActionTable AS log_link_visit_action + LEFT JOIN $logActionTable AS log_action + ON log_link_visit_action.idaction_url = log_action.idaction + WHERE ( log_link_visit_action.server_time >= ? + AND log_link_visit_action.server_time <= ? + AND log_link_visit_action.idsite = ? ) + AND ( log_action.type = ? )", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenJoinConversionOnAction() + { + $actionType = 3; + $idSite = 1; + $select = 'log_conversion.idgoal AS `idgoal`, + log_conversion.custom_dimension_1 AS `custom_dimension_1`, + count(*) AS `1`, + count(distinct log_conversion.idvisit) AS `3`,'; + $from = 'log_conversion'; + $where = 'log_conversion.server_time >= ? + AND log_conversion.server_time <= ? + AND log_conversion.idsite IN (?)'; + $bind = array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite); + + $segment = 'actionType==' . $actionType; + $segment = new Segment($segment, $idSites = array()); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $logConversionsTable = Common::prefixTable('log_conversion'); + $logActionTable = Common::prefixTable('log_action'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $expected = array( + "sql" => " + SELECT log_conversion.idgoal AS `idgoal`, log_conversion.custom_dimension_1 AS `custom_dimension_1`, count(*) AS `1`, count(distinct log_conversion.idvisit) AS `3`, + FROM $logConversionsTable AS log_conversion + LEFT JOIN $logLinkVisitActionTable AS log_link_visit_action + ON log_conversion.idvisit = log_link_visit_action.idvisit + LEFT JOIN $logActionTable AS log_action + ON log_link_visit_action.idaction_url = log_action.idaction + WHERE ( log_conversion.server_time >= ? + AND log_conversion.server_time <= ? + AND log_conversion.idsite IN (?) ) + AND ( log_action.type = ? )", + "bind" => array('2015-11-30 11:00:00', '2015-12-01 10:59:59', $idSite, $actionType)); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenUnionOfSegmentsAreUsed() + { + $select = 'log_visit.*'; + $from = 'log_visit'; + $where = false; + $bind = array(); + + $segment = 'actionUrl=@myTestUrl'; + $segment = new Segment($segment, $idSites = array()); + + $logVisitTable = Common::prefixTable('log_visit'); + $logLinkVisitActionTable = Common::prefixTable('log_link_visit_action'); + + $query = $segment->getSelectQuery($select, $from, $where, $bind); + + $expected = array( + "sql" => " SELECT log_inner.* FROM ( + SELECT log_visit.* FROM $logVisitTable AS log_visit + LEFT JOIN $logLinkVisitActionTable AS log_link_visit_action + ON log_link_visit_action.idvisit = log_visit.idvisit + WHERE (( log_link_visit_action.idaction_url IN (SELECT idaction FROM log_action WHERE ( name LIKE CONCAT('%', ?, '%') AND type = 1 )) ) + OR ( log_link_visit_action.idaction_url IN (SELECT idaction FROM log_action WHERE ( name LIKE CONCAT('%', ?, '%') AND type = 3 )) ) + OR ( log_link_visit_action.idaction_url IN (SELECT idaction FROM log_action WHERE ( name LIKE CONCAT('%', ?, '%') AND type = 2 )) ) ) + GROUP BY log_visit.idvisit ORDER BY NULL ) AS log_inner", + "bind" => array('myTestUrl', 'myTestUrl', 'myTestUrl')); + + $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); + } + + public function test_getSelectQuery_whenJoinConversionOnLogLinkVisitAction_segmentUsesPageUrl() { $this->insertPageUrlAsAction('example.com/anypage'); $this->insertPageUrlAsAction('example.com/anypage_bis'); diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php index e686146f73..f4bc1fd5ed 100644 --- a/tests/PHPUnit/Integration/Tracker/VisitTest.php +++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php @@ -118,15 +118,37 @@ class VisitTest extends IntegrationTestCase 'http://x.com' => true, )), array(array('http://test.com', 'http://sub.test2.com'), true, array( - 'http://sub.test.com' => true, - 'http://sub.sub.test.com' => true, + 'http://sub.test.com' => false, // we do not match subdomains + 'http://sub.sub.test.com' => false, 'http://subtest.com' => false, 'http://test.com.org' => false, + 'http://test2.com' => false, 'http://sub.test2.com' => true, - 'http://x.sub.test2.com' => true, + 'http://test.com' => true, + 'http://x.sub.test2.com' => false, 'http://xsub.test2.com' => false, 'http://sub.test2.com.org' => false, )), + array(array('http://test.com/path', 'http://test2.com/sub/dir'), true, array( + 'http://test.com/path' => true, // test matching path + 'http://test.com/path/' => true, + 'http://test.com/path/test' => true, + + 'http://test.com/path1' => false, + 'http://test.com/' => false, + 'http://test.com' => false, + 'http://test.com/foo' => false, + 'http://sub.test.com/path' => false, // we still do not match subdomains + + 'http://test2.com/sub/dir' => true, + 'http://test2.com/sub/dir/' => true, + 'http://test2.com/sub/dir/test' => true, + + 'http://test2.com/sub/foo/' => false, + 'http://test2.com/sub/' => false, + 'http://test2.com/' => false, + 'http://test2.com/dir/sub' => false, + )), ); } @@ -142,7 +164,7 @@ class VisitTest extends IntegrationTestCase 'rec' => 1, 'url' => $url ))); - $this->assertEquals($isTracked, !$visitExclude->isExcluded()); + $this->assertEquals($isTracked, !$visitExclude->isExcluded(), $url . ' is not returning expected result'); } } diff --git a/tests/PHPUnit/System/AutoSuggestAPITest.php b/tests/PHPUnit/System/AutoSuggestAPITest.php index 62a0175d01..c1404e5757 100644 --- a/tests/PHPUnit/System/AutoSuggestAPITest.php +++ b/tests/PHPUnit/System/AutoSuggestAPITest.php @@ -17,7 +17,6 @@ use Piwik\Plugins\CustomVariables\Columns\CustomVariableValue; use Piwik\Plugins\CustomVariables\Model; use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManyVisitsWithGeoIP; -use Piwik\Tests\Framework\Fixture; use Piwik\Tracker\Cache; use Piwik\Cache as PiwikCache; diff --git a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php index 74dbb05d73..12a60f3821 100644 --- a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php +++ b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php @@ -13,6 +13,7 @@ use Piwik\Plugins\VisitFrequency\API as VisitFrequencyApi; use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SqlDump; use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestingEnvironmentVariables; /** * Tests that Piwik 2.0 works w/ data from Piwik 1.12. @@ -32,6 +33,7 @@ class BackwardsCompatibility1XTest extends SystemTestCase // note: not sure why I have to manually install plugin \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomAlerts')->install(); + \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomDimensions')->install(); $result = Fixture::updateDatabase(); if ($result === false) { diff --git a/tests/PHPUnit/System/TrackerTest.php b/tests/PHPUnit/System/TrackerTest.php index 461b0a2385..417b40f72a 100644 --- a/tests/PHPUnit/System/TrackerTest.php +++ b/tests/PHPUnit/System/TrackerTest.php @@ -180,9 +180,7 @@ class TrackerTest extends IntegrationTestCase public function test_scheduledTasks_CanBeRunThroughTracker_WithOutputIncluded_IfDebugQueryParamUsed() { $environment = $this->setScheduledTasksToRunInTracker(); - $config = $environment->configOverride; - $config['log']['log_writers'] = array('screen'); - $environment->configOverride = $config; + $environment->overrideConfig('log', 'log_writers', array('screen')); $environment->save(); $urlToTest = $this->getSimpleTrackingUrl() . '&debug=1'; @@ -298,7 +296,8 @@ class TrackerTest extends IntegrationTestCase $testingEnvironment = new \Piwik\Tests\Framework\TestingEnvironmentVariables(); $testingEnvironment->testCaseClass = 'Piwik\Tests\System\TrackerTest'; $testingEnvironment->addScheduledTask = true; - $testingEnvironment->configOverride = array('Tracker' => array('scheduled_tasks_min_interval' => 1, 'debug_on_demand' => 1)); + $testingEnvironment->overrideConfig('Tracker', array('scheduled_tasks_min_interval' => 1, 'debug_on_demand' => 1)); + $testingEnvironment->overrideConfig('log', array()); $testingEnvironment->save(); return $testingEnvironment; diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php index 92a4f2dde2..bad8cc45b3 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php @@ -48,6 +48,13 @@ class TwoVisitsWithCustomVariablesSegmentContainsTest extends SystemTestCase array("pageTitle=@Profile pa", '_SegmentPageTitleContains', $api), array("pageUrl!@user/profile", '_SegmentPageUrlExcludes', $api), array("pageTitle!@Profile pa", '_SegmentPageTitleExcludes', $api), + // starts with + array('pageUrl=^example.org/home', '_SegmentPageUrlStartsWith', array('Actions.getPageUrls')), + array('pageTitle=^Profile pa', '_SegmentPageTitleStartsWith', array('Actions.getPageTitles')), + + // ends with + array('pageUrl=$er/profile', '_SegmentPageUrlEndsWith', array('Actions.getPageUrls')), + array('pageTitle=$page', '_SegmentPageTitleEndsWith', array('Actions.getPageTitles')), ); foreach ($segmentsToTest as $segment) { diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php index 3667f7f65b..482b0d12d8 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php @@ -64,10 +64,13 @@ class TwoVisitsWithCustomVariablesSegmentMatchNONETest extends SystemTestCase if ($segment == 'visitEcommerceStatus') { $value = 'none'; } + if ($segment == 'actionType') { + $value = 'pageviews'; + } $matchNone = $segment . '!=' . $value; // deviceType != campaign matches ALL visits, but we want to match None - if($segment == 'deviceType') { + if ($segment == 'deviceType') { $matchNone = $segment . '==car%20browser'; } $segmentExpression[] = $matchNone; diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__API.getSuggestedValuesForSegment.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__API.getSuggestedValuesForSegment.xml new file mode 100644 index 0000000000..cff62022a9 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__API.getSuggestedValuesForSegment.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row>pageviews</row> + <row>contents</row> + <row>sitesearches</row> + <row>events</row> + <row>outlinks</row> + <row>downloads</row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__VisitsSummary.get_range.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__VisitsSummary.get_range.xml new file mode 100644 index 0000000000..f3bee672d6 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionType__VisitsSummary.get_range.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_visits>35</nb_visits> + <nb_actions>95</nb_actions> + <nb_visits_converted>35</nb_visits_converted> + <bounce_count>18</bounce_count> + <sum_visit_length>27557</sum_visit_length> + <max_actions>5</max_actions> + <bounce_rate>51%</bounce_rate> + <nb_actions_per_visit>2.7</nb_actions_per_visit> + <avg_time_on_site>787</avg_time_on_site> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml new file mode 100644 index 0000000000..2e03969e6d --- /dev/null +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row>http://piwik.net/grue/lair</row> + <row>http://piwik.net/space/quest/iv</row> + <row>http://example-outlink.org/1.html</row> + <row>http://example.org/path/file1.zip</row> + <row>http://example.org/path/file0.zip</row> + <row>http://example-outlink.org/0.html</row> + <row>http://example.org/path/file2.zip</row> + <row>http://example.org/path/file3.zip</row> + <row>http://example-outlink.org/3.html</row> + <row>http://example-outlink.org/2.html</row> + <row>http://example.org/path/file4.zip</row> + <row>http://example.org/path/file5.zip</row> + <row>http://example.org/path/file8.zip</row> + <row>http://example-outlink.org/6.html</row> + <row>http://example-outlink.org/7.html</row> + <row>http://example-outlink.org/5.html</row> + <row>http://example-outlink.org/4.html</row> + <row>http://example.org/path/file7.zip</row> + <row>http://example-outlink.org/8.html</row> + <row>http://example.org/path/file6.zip</row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__VisitsSummary.get_range.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__VisitsSummary.get_range.xml new file mode 100644 index 0000000000..7ace3fcbe7 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_actionUrl__VisitsSummary.get_range.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_visits>18</nb_visits> + <nb_actions>18</nb_actions> + <nb_visits_converted>18</nb_visits_converted> + <bounce_count>18</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableName__API.getSuggestedValuesForSegment.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableName__API.getSuggestedValuesForSegment.xml index b3e5836d32..9c10ae8b37 100644 --- a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableName__API.getSuggestedValuesForSegment.xml +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableName__API.getSuggestedValuesForSegment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar 5 name</row> <row>Cvar 1 name</row> + <row>Cvar 5 name</row> </result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml index fb3a6b6413..0ab1e3a74c 100644 --- a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>CAT</row> + <row>Cvar5 PAGE value is 0</row> <row>Cvar5 PAGE value is 1</row> <row>Cvar2 PAGE value is 1</row> <row>Cvar2 PAGE value is 0</row> - <row>Cvar5 PAGE value is 0</row> - <row>Cvar5 PAGE value is 3</row> <row>Cvar2 PAGE value is 3</row> - <row>Cvar2 PAGE value is 2</row> <row>Cvar5 PAGE value is 2</row> - <row>Cvar5 PAGE value is 4</row> + <row>Cvar5 PAGE value is 3</row> + <row>Cvar2 PAGE value is 2</row> + <row>Cvar2 PAGE value is 5</row> <row>Cvar2 PAGE value is 4</row> - <row>Cvar2 PAGE value is 7</row> - <row>Cvar5 PAGE value is 8</row> - <row>Cvar2 PAGE value is 8</row> - <row>Cvar5 PAGE value is 7</row> <row>Cvar2 PAGE value is 6</row> - <row>Cvar2 PAGE value is 5</row> - <row>Cvar5 PAGE value is 6</row> + <row>Cvar5 PAGE value is 8</row> <row>Cvar5 PAGE value is 5</row> + <row>Cvar5 PAGE value is 6</row> + <row>Cvar5 PAGE value is 4</row> + <row>Cvar5 PAGE value is 7</row> + <row>Cvar2 PAGE value is 8</row> + <row>Cvar2 PAGE value is 7</row> </result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml index 662ed617b1..6be328a177 100644 --- a/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml +++ b/tests/PHPUnit/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar5 value is 1</row> - <row>Cvar1 value is 0</row> <row>Cvar1 value is 1</row> + <row>Cvar1 value is 0</row> + <row>Cvar5 value is 1</row> <row>Cvar5 value is 0</row> <row>Cvar1 value is 3</row> - <row>Cvar5 value is 3</row> - <row>Cvar5 value is 2</row> <row>Cvar1 value is 2</row> - <row>Cvar5 value is 4</row> + <row>Cvar5 value is 2</row> + <row>Cvar5 value is 3</row> <row>Cvar1 value is 4</row> <row>Cvar5 value is 7</row> - <row>Cvar1 value is 7</row> - <row>Cvar5 value is 8</row> - <row>Cvar1 value is 6</row> + <row>Cvar1 value is 5</row> <row>Cvar5 value is 6</row> + <row>Cvar1 value is 7</row> <row>Cvar5 value is 5</row> - <row>Cvar1 value is 5</row> + <row>Cvar5 value is 8</row> <row>Cvar1 value is 8</row> + <row>Cvar5 value is 4</row> + <row>Cvar1 value is 6</row> </result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_day.xml b/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_day.xml index 38fec6a150..c2c4ac7f78 100644 --- a/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_day.xml +++ b/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_day.xml @@ -9,7 +9,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>21</pageId> <eventCategory>Movie</eventCategory> @@ -114,7 +114,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>20</pageId> <eventCategory>Movie</eventCategory> @@ -219,7 +219,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>16</pageId> <eventCategory>Movie</eventCategory> @@ -233,7 +233,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>17</pageId> <eventCategory>Movie</eventCategory> @@ -247,7 +247,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>19</pageId> <eventCategory>Movie</eventCategory> @@ -261,7 +261,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>22</pageId> <eventCategory>Movie</eventCategory> @@ -290,7 +290,7 @@ <row> <type>event</type> <url>http://example.org/finishedMovie</url> - <pageIdAction>23</pageIdAction> + <pageIdAction>25</pageIdAction> <pageId>24</pageId> <eventCategory>event category Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long ---> SHOULD APPEAR IN TEST OUTPUT NOT TRUNCATED <---</eventCategory> @@ -397,7 +397,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>18</pageId> <eventCategory>Movie</eventCategory> @@ -526,7 +526,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>2</pageId> <eventCategory>Music</eventCategory> @@ -546,7 +546,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>3</pageId> <eventCategory>Music</eventCategory> @@ -566,7 +566,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>4</pageId> <eventCategory>Music</eventCategory> @@ -586,7 +586,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>5</pageId> <eventCategory>Music</eventCategory> @@ -606,7 +606,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>6</pageId> <eventCategory>Music</eventCategory> @@ -626,7 +626,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>7</pageId> <eventCategory>Music</eventCategory> @@ -647,7 +647,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>8</pageId> <eventCategory>Music</eventCategory> @@ -669,7 +669,7 @@ <type>action</type> <url>http://example.org/movies</url> <pageTitle>Movie Theater</pageTitle> - <pageIdAction>12</pageIdAction> + <pageIdAction>13</pageIdAction> <pageId>9</pageId> <generationTime>0.67s</generationTime> @@ -681,7 +681,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>10</pageId> <eventCategory>Movie</eventCategory> @@ -695,7 +695,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>11</pageId> <eventCategory>Movie</eventCategory> @@ -709,7 +709,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>12</pageId> <eventCategory>Movie</eventCategory> @@ -723,7 +723,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>13</pageId> <eventCategory>Movie</eventCategory> @@ -737,7 +737,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>14</pageId> <eventCategory>Movie</eventCategory> @@ -751,7 +751,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>15</pageId> <eventCategory>Movie</eventCategory> @@ -857,7 +857,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>45</pageId> <eventCategory>Movie</eventCategory> @@ -958,7 +958,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>44</pageId> <eventCategory>Movie</eventCategory> @@ -1059,7 +1059,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>40</pageId> <eventCategory>Movie</eventCategory> @@ -1073,7 +1073,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>41</pageId> <eventCategory>Movie</eventCategory> @@ -1087,7 +1087,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>43</pageId> <eventCategory>Movie</eventCategory> @@ -1101,7 +1101,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>46</pageId> <eventCategory>Movie</eventCategory> @@ -1130,7 +1130,7 @@ <row> <type>event</type> <url>http://example.org/finishedMovie</url> - <pageIdAction>23</pageIdAction> + <pageIdAction>25</pageIdAction> <pageId>48</pageId> <eventCategory>event category Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long ---> SHOULD APPEAR IN TEST OUTPUT NOT TRUNCATED <---</eventCategory> @@ -1233,7 +1233,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>42</pageId> <eventCategory>Movie</eventCategory> @@ -1358,7 +1358,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>26</pageId> <eventCategory>Music</eventCategory> @@ -1378,7 +1378,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>27</pageId> <eventCategory>Music</eventCategory> @@ -1398,7 +1398,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>28</pageId> <eventCategory>Music</eventCategory> @@ -1418,7 +1418,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>29</pageId> <eventCategory>Music</eventCategory> @@ -1438,7 +1438,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>30</pageId> <eventCategory>Music</eventCategory> @@ -1458,7 +1458,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>31</pageId> <eventCategory>Music</eventCategory> @@ -1479,7 +1479,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>32</pageId> <eventCategory>Music</eventCategory> @@ -1501,7 +1501,7 @@ <type>action</type> <url>http://example.org/movies</url> <pageTitle>Movie Theater</pageTitle> - <pageIdAction>12</pageIdAction> + <pageIdAction>13</pageIdAction> <pageId>33</pageId> <generationTime>0.67s</generationTime> @@ -1513,7 +1513,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>34</pageId> <eventCategory>Movie</eventCategory> @@ -1527,7 +1527,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>35</pageId> <eventCategory>Movie</eventCategory> @@ -1541,7 +1541,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>36</pageId> <eventCategory>Movie</eventCategory> @@ -1555,7 +1555,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>37</pageId> <eventCategory>Movie</eventCategory> @@ -1569,7 +1569,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>38</pageId> <eventCategory>Movie</eventCategory> @@ -1583,7 +1583,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>39</pageId> <eventCategory>Movie</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_month.xml index 38fec6a150..c2c4ac7f78 100644 --- a/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_CustomEvents__Live.getLastVisitsDetails_month.xml @@ -9,7 +9,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>21</pageId> <eventCategory>Movie</eventCategory> @@ -114,7 +114,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>20</pageId> <eventCategory>Movie</eventCategory> @@ -219,7 +219,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>16</pageId> <eventCategory>Movie</eventCategory> @@ -233,7 +233,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>17</pageId> <eventCategory>Movie</eventCategory> @@ -247,7 +247,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>19</pageId> <eventCategory>Movie</eventCategory> @@ -261,7 +261,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>22</pageId> <eventCategory>Movie</eventCategory> @@ -290,7 +290,7 @@ <row> <type>event</type> <url>http://example.org/finishedMovie</url> - <pageIdAction>23</pageIdAction> + <pageIdAction>25</pageIdAction> <pageId>24</pageId> <eventCategory>event category Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long ---> SHOULD APPEAR IN TEST OUTPUT NOT TRUNCATED <---</eventCategory> @@ -397,7 +397,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>18</pageId> <eventCategory>Movie</eventCategory> @@ -526,7 +526,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>2</pageId> <eventCategory>Music</eventCategory> @@ -546,7 +546,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>3</pageId> <eventCategory>Music</eventCategory> @@ -566,7 +566,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>4</pageId> <eventCategory>Music</eventCategory> @@ -586,7 +586,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>5</pageId> <eventCategory>Music</eventCategory> @@ -606,7 +606,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>6</pageId> <eventCategory>Music</eventCategory> @@ -626,7 +626,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>7</pageId> <eventCategory>Music</eventCategory> @@ -647,7 +647,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>8</pageId> <eventCategory>Music</eventCategory> @@ -669,7 +669,7 @@ <type>action</type> <url>http://example.org/movies</url> <pageTitle>Movie Theater</pageTitle> - <pageIdAction>12</pageIdAction> + <pageIdAction>13</pageIdAction> <pageId>9</pageId> <generationTime>0.67s</generationTime> @@ -681,7 +681,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>10</pageId> <eventCategory>Movie</eventCategory> @@ -695,7 +695,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>11</pageId> <eventCategory>Movie</eventCategory> @@ -709,7 +709,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>12</pageId> <eventCategory>Movie</eventCategory> @@ -723,7 +723,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>13</pageId> <eventCategory>Movie</eventCategory> @@ -737,7 +737,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>14</pageId> <eventCategory>Movie</eventCategory> @@ -751,7 +751,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>15</pageId> <eventCategory>Movie</eventCategory> @@ -857,7 +857,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>45</pageId> <eventCategory>Movie</eventCategory> @@ -958,7 +958,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>44</pageId> <eventCategory>Movie</eventCategory> @@ -1059,7 +1059,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>40</pageId> <eventCategory>Movie</eventCategory> @@ -1073,7 +1073,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>41</pageId> <eventCategory>Movie</eventCategory> @@ -1087,7 +1087,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>43</pageId> <eventCategory>Movie</eventCategory> @@ -1101,7 +1101,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>46</pageId> <eventCategory>Movie</eventCategory> @@ -1130,7 +1130,7 @@ <row> <type>event</type> <url>http://example.org/finishedMovie</url> - <pageIdAction>23</pageIdAction> + <pageIdAction>25</pageIdAction> <pageId>48</pageId> <eventCategory>event category Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long Extremely long ---> SHOULD APPEAR IN TEST OUTPUT NOT TRUNCATED <---</eventCategory> @@ -1233,7 +1233,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>42</pageId> <eventCategory>Movie</eventCategory> @@ -1358,7 +1358,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>26</pageId> <eventCategory>Music</eventCategory> @@ -1378,7 +1378,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>27</pageId> <eventCategory>Music</eventCategory> @@ -1398,7 +1398,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>28</pageId> <eventCategory>Music</eventCategory> @@ -1418,7 +1418,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>29</pageId> <eventCategory>Music</eventCategory> @@ -1438,7 +1438,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>30</pageId> <eventCategory>Music</eventCategory> @@ -1458,7 +1458,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>31</pageId> <eventCategory>Music</eventCategory> @@ -1479,7 +1479,7 @@ <row> <type>event</type> <url>http://example.org/webradio</url> - <pageIdAction>2</pageIdAction> + <pageIdAction>3</pageIdAction> <pageId>32</pageId> <eventCategory>Music</eventCategory> @@ -1501,7 +1501,7 @@ <type>action</type> <url>http://example.org/movies</url> <pageTitle>Movie Theater</pageTitle> - <pageIdAction>12</pageIdAction> + <pageIdAction>13</pageIdAction> <pageId>33</pageId> <generationTime>0.67s</generationTime> @@ -1513,7 +1513,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>34</pageId> <eventCategory>Movie</eventCategory> @@ -1527,7 +1527,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>35</pageId> <eventCategory>Movie</eventCategory> @@ -1541,7 +1541,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>36</pageId> <eventCategory>Movie</eventCategory> @@ -1555,7 +1555,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>37</pageId> <eventCategory>Movie</eventCategory> @@ -1569,7 +1569,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>38</pageId> <eventCategory>Movie</eventCategory> @@ -1583,7 +1583,7 @@ <row> <type>event</type> <url>http://example.org/movies</url> - <pageIdAction>12</pageIdAction> + <pageIdAction>14</pageIdAction> <pageId>39</pageId> <eventCategory>Movie</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml index c2c0a93fff..6d6e6128de 100644 --- a/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_FlattenReports__CustomVariables.getCustomVariables_day.xml @@ -10,11 +10,23 @@ <sum_visit_length>6</sum_visit_length> <bounce_count>0</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <is_aggregate>1</is_aggregate> </row> <row> <label>CustomVarPage</label> <nb_actions>18</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <is_aggregate>1</is_aggregate> </row> <row> @@ -68,6 +80,12 @@ <sum_visit_length>1</sum_visit_length> <bounce_count>0</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <is_aggregate>1</is_aggregate> </row> <row> @@ -90,6 +108,12 @@ <row> <label>CustomVarPage</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <is_aggregate>1</is_aggregate> </row> </result> diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableExtractionDimensions.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableExtractionDimensions.xml new file mode 100644 index 0000000000..7a397597a0 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableExtractionDimensions.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>url</value> + <name>Page URL</name> + </row> + <row> + <value>urlparam</value> + <name>Page URL Parameter</name> + </row> + <row> + <value>action_name</value> + <name>Page Title</name> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableScopes.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableScopes.xml new file mode 100644 index 0000000000..149cf8b31c --- /dev/null +++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getAvailableScopes.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>visit</value> + <name>Visit</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>0</supportsExtractions> + </row> + <row> + <value>action</value> + <name>Action</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>1</supportsExtractions> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getConfiguredCustomDimensions.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getConfiguredCustomDimensions.xml new file mode 100644 index 0000000000..c234bed59e --- /dev/null +++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomDimensions.getConfiguredCustomDimensions.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result />
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml index dc1a11ab2b..4582327ecc 100644 --- a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml +++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getCustomVariables_month.xml @@ -3,6 +3,16 @@ <row> <label>HTTP-code</label> <nb_actions>43</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + <row> + <scope>page</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==HTTP-code</segment> <subtable> <row> @@ -61,6 +71,12 @@ <revenue>25</revenue> <sum_daily_nb_uniq_visitors>7</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Not-Bot</segment> <subtable> <row> @@ -151,6 +167,12 @@ <revenue>10</revenue> <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>1</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==User+Name</segment> <subtable> <row> @@ -196,6 +218,12 @@ <row> <label>Generation Time</label> <nb_actions>4</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Generation+Time</segment> <subtable> <row> @@ -221,6 +249,12 @@ <row> <label>Windows Status Code</label> <nb_actions>4</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Windows+Status+Code</segment> <subtable> <row> @@ -267,6 +301,12 @@ <revenue>5</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Bot</segment> <subtable> <row> @@ -308,6 +348,12 @@ <revenue>5</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Forum+status</segment> <subtable> <row> @@ -349,6 +395,12 @@ <revenue>5</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml new file mode 100644 index 0000000000..4e74cbbfdf --- /dev/null +++ b/tests/PHPUnit/System/expected/test_ImportLogs__CustomVariables.getUsagesOfSlots.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <scope>visit</scope> + <index>1</index> + <usages> + <row> + <name>Domain landed</name> + <nb_visits>12</nb_visits> + <nb_actions>16</nb_actions> + </row> + <row> + <name>Not-Bot</name> + <nb_visits>7</nb_visits> + <nb_actions>10</nb_actions> + </row> + <row> + <name>User Name</name> + <nb_visits>3</nb_visits> + <nb_actions>5</nb_actions> + </row> + <row> + <name>Bot</name> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </usages> + </row> + <row> + <scope>visit</scope> + <index>2</index> + <usages> + <row> + <name>Demo language</name> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </usages> + </row> + <row> + <scope>visit</scope> + <index>3</index> + <usages> + <row> + <name>Forum status</name> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </usages> + </row> + <row> + <scope>visit</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>5</index> + <usages> + <row> + <name>VisitorType</name> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </usages> + </row> + <row> + <scope>page</scope> + <index>1</index> + <usages> + <row> + <name>HTTP-code</name> + <nb_visits>0</nb_visits> + <nb_actions>69</nb_actions> + </row> + <row> + <name>Generation Time</name> + <nb_visits>0</nb_visits> + <nb_actions>4</nb_actions> + </row> + </usages> + </row> + <row> + <scope>page</scope> + <index>2</index> + <usages> + <row> + <name>Windows Status Code</name> + <nb_visits>0</nb_visits> + <nb_actions>4</nb_actions> + </row> + </usages> + </row> + <row> + <scope>page</scope> + <index>3</index> + <usages> + <row> + <name>HTTP-code</name> + <nb_visits>0</nb_visits> + <nb_actions>69</nb_actions> + </row> + </usages> + </row> + <row> + <scope>page</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>5</index> + <usages> + </usages> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_1__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_1__Live.getLastVisitsDetails_month.xml index b1ce633309..23daf4bf06 100644 --- a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_1__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_1__Live.getLastVisitsDetails_month.xml @@ -62,7 +62,7 @@ <type>download</type> <url>http://example.org/path/file8.zip</url> <pageTitle /> - <pageIdAction>46</pageIdAction> + <pageIdAction>47</pageIdAction> <pageId>48</pageId> <timeSpent>180</timeSpent> @@ -74,7 +74,7 @@ <type>outlink</type> <url>http://example-outlink.org/8.html</url> <pageTitle /> - <pageIdAction>47</pageIdAction> + <pageIdAction>48</pageIdAction> <pageId>49</pageId> <timeSpent>180</timeSpent> @@ -85,7 +85,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>50</pageId> <eventCategory>Cat8</eventCategory> @@ -360,7 +360,7 @@ <type>download</type> <url>http://example.org/path/file7.zip</url> <pageTitle /> - <pageIdAction>41</pageIdAction> + <pageIdAction>42</pageIdAction> <pageId>42</pageId> <timeSpent>180</timeSpent> @@ -372,7 +372,7 @@ <type>outlink</type> <url>http://example-outlink.org/7.html</url> <pageTitle /> - <pageIdAction>42</pageIdAction> + <pageIdAction>43</pageIdAction> <pageId>43</pageId> <timeSpent>180</timeSpent> @@ -383,7 +383,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>44</pageId> <eventCategory>Cat7</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_2__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_2__Live.getLastVisitsDetails_month.xml index 40321dd60b..69d9272531 100644 --- a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_2__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_offsetAndLimit_2__Live.getLastVisitsDetails_month.xml @@ -191,7 +191,7 @@ <type>download</type> <url>http://example.org/path/file6.zip</url> <pageTitle /> - <pageIdAction>36</pageIdAction> + <pageIdAction>37</pageIdAction> <pageId>37</pageId> <timeSpent>180</timeSpent> @@ -203,7 +203,7 @@ <type>outlink</type> <url>http://example-outlink.org/6.html</url> <pageTitle /> - <pageIdAction>37</pageIdAction> + <pageIdAction>38</pageIdAction> <pageId>38</pageId> <timeSpent>180</timeSpent> @@ -214,7 +214,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>39</pageId> <eventCategory>Cat6</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortByIdVisit__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortByIdVisit__Live.getLastVisitsDetails_month.xml index 0f01c7764b..0323bd788c 100644 --- a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortByIdVisit__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortByIdVisit__Live.getLastVisitsDetails_month.xml @@ -173,7 +173,7 @@ <type>download</type> <url>http://example.org/path/file8.zip</url> <pageTitle /> - <pageIdAction>46</pageIdAction> + <pageIdAction>47</pageIdAction> <pageId>48</pageId> <timeSpent>180</timeSpent> @@ -185,7 +185,7 @@ <type>outlink</type> <url>http://example-outlink.org/8.html</url> <pageTitle /> - <pageIdAction>47</pageIdAction> + <pageIdAction>48</pageIdAction> <pageId>49</pageId> <timeSpent>180</timeSpent> @@ -196,7 +196,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>50</pageId> <eventCategory>Cat8</eventCategory> @@ -471,7 +471,7 @@ <type>download</type> <url>http://example.org/path/file7.zip</url> <pageTitle /> - <pageIdAction>41</pageIdAction> + <pageIdAction>42</pageIdAction> <pageId>42</pageId> <timeSpent>180</timeSpent> @@ -483,7 +483,7 @@ <type>outlink</type> <url>http://example-outlink.org/7.html</url> <pageTitle /> - <pageIdAction>42</pageIdAction> + <pageIdAction>43</pageIdAction> <pageId>43</pageId> <timeSpent>180</timeSpent> @@ -494,7 +494,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>44</pageId> <eventCategory>Cat7</eventCategory> @@ -787,7 +787,7 @@ <type>download</type> <url>http://example.org/path/file6.zip</url> <pageTitle /> - <pageIdAction>36</pageIdAction> + <pageIdAction>37</pageIdAction> <pageId>37</pageId> <timeSpent>180</timeSpent> @@ -799,7 +799,7 @@ <type>outlink</type> <url>http://example-outlink.org/6.html</url> <pageTitle /> - <pageIdAction>37</pageIdAction> + <pageIdAction>38</pageIdAction> <pageId>38</pageId> <timeSpent>180</timeSpent> @@ -810,7 +810,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>39</pageId> <eventCategory>Cat6</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortDesc__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortDesc__Live.getLastVisitsDetails_month.xml index 0f01c7764b..0323bd788c 100644 --- a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortDesc__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest_Live.getLastVisitsDetails_sortDesc__Live.getLastVisitsDetails_month.xml @@ -173,7 +173,7 @@ <type>download</type> <url>http://example.org/path/file8.zip</url> <pageTitle /> - <pageIdAction>46</pageIdAction> + <pageIdAction>47</pageIdAction> <pageId>48</pageId> <timeSpent>180</timeSpent> @@ -185,7 +185,7 @@ <type>outlink</type> <url>http://example-outlink.org/8.html</url> <pageTitle /> - <pageIdAction>47</pageIdAction> + <pageIdAction>48</pageIdAction> <pageId>49</pageId> <timeSpent>180</timeSpent> @@ -196,7 +196,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>50</pageId> <eventCategory>Cat8</eventCategory> @@ -471,7 +471,7 @@ <type>download</type> <url>http://example.org/path/file7.zip</url> <pageTitle /> - <pageIdAction>41</pageIdAction> + <pageIdAction>42</pageIdAction> <pageId>42</pageId> <timeSpent>180</timeSpent> @@ -483,7 +483,7 @@ <type>outlink</type> <url>http://example-outlink.org/7.html</url> <pageTitle /> - <pageIdAction>42</pageIdAction> + <pageIdAction>43</pageIdAction> <pageId>43</pageId> <timeSpent>180</timeSpent> @@ -494,7 +494,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>44</pageId> <eventCategory>Cat7</eventCategory> @@ -787,7 +787,7 @@ <type>download</type> <url>http://example.org/path/file6.zip</url> <pageTitle /> - <pageIdAction>36</pageIdAction> + <pageIdAction>37</pageIdAction> <pageId>37</pageId> <timeSpent>180</timeSpent> @@ -799,7 +799,7 @@ <type>outlink</type> <url>http://example-outlink.org/6.html</url> <pageTitle /> - <pageIdAction>37</pageIdAction> + <pageIdAction>38</pageIdAction> <pageId>38</pageId> <timeSpent>180</timeSpent> @@ -810,7 +810,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>39</pageId> <eventCategory>Cat6</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest__Live.getLastVisitsDetails_month.xml index 4b4f490f44..4665c485f0 100644 --- a/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_ManyVisitorsOneWebsiteTest__Live.getLastVisitsDetails_month.xml @@ -173,7 +173,7 @@ <type>download</type> <url>http://example.org/path/file8.zip</url> <pageTitle /> - <pageIdAction>46</pageIdAction> + <pageIdAction>47</pageIdAction> <pageId>48</pageId> <timeSpent>180</timeSpent> @@ -185,7 +185,7 @@ <type>outlink</type> <url>http://example-outlink.org/8.html</url> <pageTitle /> - <pageIdAction>47</pageIdAction> + <pageIdAction>48</pageIdAction> <pageId>49</pageId> <timeSpent>180</timeSpent> @@ -196,7 +196,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>50</pageId> <eventCategory>Cat8</eventCategory> @@ -471,7 +471,7 @@ <type>download</type> <url>http://example.org/path/file7.zip</url> <pageTitle /> - <pageIdAction>41</pageIdAction> + <pageIdAction>42</pageIdAction> <pageId>42</pageId> <timeSpent>180</timeSpent> @@ -483,7 +483,7 @@ <type>outlink</type> <url>http://example-outlink.org/7.html</url> <pageTitle /> - <pageIdAction>42</pageIdAction> + <pageIdAction>43</pageIdAction> <pageId>43</pageId> <timeSpent>180</timeSpent> @@ -494,7 +494,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>44</pageId> <eventCategory>Cat7</eventCategory> @@ -787,7 +787,7 @@ <type>download</type> <url>http://example.org/path/file6.zip</url> <pageTitle /> - <pageIdAction>36</pageIdAction> + <pageIdAction>37</pageIdAction> <pageId>37</pageId> <timeSpent>180</timeSpent> @@ -799,7 +799,7 @@ <type>outlink</type> <url>http://example-outlink.org/6.html</url> <pageTitle /> - <pageIdAction>37</pageIdAction> + <pageIdAction>38</pageIdAction> <pageId>38</pageId> <timeSpent>180</timeSpent> @@ -810,7 +810,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>39</pageId> <eventCategory>Cat6</eventCategory> @@ -1085,7 +1085,7 @@ <type>download</type> <url>http://example.org/path/file5.zip</url> <pageTitle /> - <pageIdAction>31</pageIdAction> + <pageIdAction>32</pageIdAction> <pageId>31</pageId> <timeSpent>180</timeSpent> @@ -1097,7 +1097,7 @@ <type>outlink</type> <url>http://example-outlink.org/5.html</url> <pageTitle /> - <pageIdAction>32</pageIdAction> + <pageIdAction>33</pageIdAction> <pageId>32</pageId> <timeSpent>180</timeSpent> @@ -1108,7 +1108,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>33</pageId> <eventCategory>Cat5</eventCategory> @@ -1401,7 +1401,7 @@ <type>download</type> <url>http://example.org/path/file4.zip</url> <pageTitle /> - <pageIdAction>26</pageIdAction> + <pageIdAction>27</pageIdAction> <pageId>26</pageId> <timeSpent>180</timeSpent> @@ -1413,7 +1413,7 @@ <type>outlink</type> <url>http://example-outlink.org/4.html</url> <pageTitle /> - <pageIdAction>27</pageIdAction> + <pageIdAction>28</pageIdAction> <pageId>27</pageId> <timeSpent>180</timeSpent> @@ -1424,7 +1424,7 @@ <row> <type>event</type> <url>http://piwik.net/space/quest/iv</url> - <pageIdAction>4</pageIdAction> + <pageIdAction>8</pageIdAction> <pageId>28</pageId> <eventCategory>Cat4</eventCategory> diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableExtractionDimensions.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableExtractionDimensions.xml new file mode 100644 index 0000000000..7a397597a0 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableExtractionDimensions.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>url</value> + <name>Page URL</name> + </row> + <row> + <value>urlparam</value> + <name>Page URL Parameter</name> + </row> + <row> + <value>action_name</value> + <name>Page Title</name> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableScopes.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableScopes.xml new file mode 100644 index 0000000000..149cf8b31c --- /dev/null +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getAvailableScopes.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>visit</value> + <name>Visit</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>0</supportsExtractions> + </row> + <row> + <value>action</value> + <name>Action</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>1</supportsExtractions> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getConfiguredCustomDimensions.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getConfiguredCustomDimensions.xml new file mode 100644 index 0000000000..c234bed59e --- /dev/null +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomDimensions.getConfiguredCustomDimensions.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result />
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml new file mode 100644 index 0000000000..81163427e5 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__CustomVariables.getUsagesOfSlots.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <scope>visit</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>5</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>5</index> + <usages> + </usages> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_hideColumns___API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_hideColumns___API.getProcessedReport_day.xml index 8202b69b04..3ecc645c62 100644 --- a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_hideColumns___API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_hideColumns___API.getProcessedReport_day.xml @@ -58,7 +58,7 @@ <reportMetadata> <row> - <idsubdatatable>2078</idsubdatatable> + <idsubdatatable>5119</idsubdatatable> </row> </reportMetadata> <reportTotal> diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_showColumns___API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_showColumns___API.getProcessedReport_day.xml index 450961285b..96248d9ba3 100644 --- a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_showColumns___API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_showColumns___API.getProcessedReport_day.xml @@ -67,7 +67,7 @@ <reportMetadata> <row> - <idsubdatatable>2082</idsubdatatable> + <idsubdatatable>5123</idsubdatatable> </row> </reportMetadata> <reportTotal> diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml new file mode 100644 index 0000000000..81163427e5 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits_withCookieSupport__CustomVariables.getUsagesOfSlots.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <scope>visit</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>5</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>5</index> + <usages> + </usages> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_OneVisitor_SeveralDays_ImportedInRandomOrderTest_shouldShowOneVisit_InEachOfThreeDays__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_OneVisitor_SeveralDays_ImportedInRandomOrderTest_shouldShowOneVisit_InEachOfThreeDays__Live.getLastVisitsDetails_month.xml index cc9433a13a..73cc01ca74 100644 --- a/tests/PHPUnit/System/expected/test_OneVisitor_SeveralDays_ImportedInRandomOrderTest_shouldShowOneVisit_InEachOfThreeDays__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_OneVisitor_SeveralDays_ImportedInRandomOrderTest_shouldShowOneVisit_InEachOfThreeDays__Live.getLastVisitsDetails_month.xml @@ -10,7 +10,7 @@ <url>http://piwik.net/</url> <pageTitle /> <pageIdAction>1</pageIdAction> - <serverTimePretty>Apr 7, 2013 10:00:00 AM</serverTimePretty> + <serverTimePretty>Apr 7, 2013 10:00:00</serverTimePretty> <pageId>1</pageId> <customVariables> <row> @@ -91,10 +91,10 @@ <plugins /> <pluginsIcons /> <serverTimestamp>1365328800</serverTimestamp> - <serverTimePretty>10:00:00 AM</serverTimePretty> + <serverTimePretty>10:00:00</serverTimePretty> <serverDatePretty>Sunday, April 7, 2013</serverDatePretty> <serverDatePrettyFirstAction>Sunday, April 7, 2013</serverDatePrettyFirstAction> - <serverTimePrettyFirstAction>10:00:00 AM</serverTimePrettyFirstAction> + <serverTimePrettyFirstAction>10:00:00</serverTimePrettyFirstAction> </row> <row> <idSite>1</idSite> @@ -106,7 +106,7 @@ <url>http://piwik.net/</url> <pageTitle /> <pageIdAction>1</pageIdAction> - <serverTimePretty>Apr 6, 2013 11:00:00 AM</serverTimePretty> + <serverTimePretty>Apr 6, 2013 11:00:00</serverTimePretty> <pageId>2</pageId> <customVariables> <row> @@ -187,10 +187,10 @@ <plugins /> <pluginsIcons /> <serverTimestamp>1365246000</serverTimestamp> - <serverTimePretty>11:00:00 AM</serverTimePretty> + <serverTimePretty>11:00:00</serverTimePretty> <serverDatePretty>Saturday, April 6, 2013</serverDatePretty> <serverDatePrettyFirstAction>Saturday, April 6, 2013</serverDatePrettyFirstAction> - <serverTimePrettyFirstAction>11:00:00 AM</serverTimePrettyFirstAction> + <serverTimePrettyFirstAction>11:00:00</serverTimePrettyFirstAction> </row> <row> <idSite>1</idSite> @@ -202,7 +202,7 @@ <url>http://piwik.net/</url> <pageTitle /> <pageIdAction>1</pageIdAction> - <serverTimePretty>Apr 5, 2013 12:00:00 PM</serverTimePretty> + <serverTimePretty>Apr 5, 2013 12:00:00</serverTimePretty> <pageId>3</pageId> <customVariables> <row> @@ -283,9 +283,9 @@ <plugins /> <pluginsIcons /> <serverTimestamp>1365163200</serverTimestamp> - <serverTimePretty>12:00:00 PM</serverTimePretty> + <serverTimePretty>12:00:00</serverTimePretty> <serverDatePretty>Friday, April 5, 2013</serverDatePretty> <serverDatePrettyFirstAction>Friday, April 5, 2013</serverDatePrettyFirstAction> - <serverTimePrettyFirstAction>12:00:00 PM</serverTimePrettyFirstAction> + <serverTimePrettyFirstAction>12:00:00</serverTimePrettyFirstAction> </row> </result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_RowEvolution_LabelReservedCharactersHierarchical__API.getRowEvolution_day.xml b/tests/PHPUnit/System/expected/test_RowEvolution_LabelReservedCharactersHierarchical__API.getRowEvolution_day.xml index 7295efb518..3b8bde9065 100644 --- a/tests/PHPUnit/System/expected/test_RowEvolution_LabelReservedCharactersHierarchical__API.getRowEvolution_day.xml +++ b/tests/PHPUnit/System/expected/test_RowEvolution_LabelReservedCharactersHierarchical__API.getRowEvolution_day.xml @@ -249,7 +249,7 @@ <change>-100%</change> </nb_visits_1> <nb_visits_2> - <name>Google - justice )(&^#%$ not corruption! (Visits)</name> + <name>Google - justice )(&^#%$ not &#039;" corruption! (Visits)</name> <min>0</min> <max>1</max> </nb_visits_2> diff --git a/tests/PHPUnit/System/expected/test_RowEvolution_flatFilters__Referrers.getSearchEngines_month.xml b/tests/PHPUnit/System/expected/test_RowEvolution_flatFilters__Referrers.getSearchEngines_month.xml index e1f0382dda..d97e75695c 100644 --- a/tests/PHPUnit/System/expected/test_RowEvolution_flatFilters__Referrers.getSearchEngines_month.xml +++ b/tests/PHPUnit/System/expected/test_RowEvolution_flatFilters__Referrers.getSearchEngines_month.xml @@ -14,7 +14,7 @@ <logo>plugins/Referrers/images/searchEngines/google.com.png</logo> </row> <row> - <label>Google - justice )(&^#%$ not corruption!</label> + <label>Google - justice )(&^#%$ not &#039;" corruption!</label> <nb_visits>8</nb_visits> <nb_actions>8</nb_actions> <max_actions>1</max_actions> @@ -23,7 +23,7 @@ <nb_visits_converted>0</nb_visits_converted> <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> - <url>http://google.com/search?q=justice+%29%28%26%5E%23%25%24+not+corruption%21</url> + <url>http://google.com/search?q=justice+%29%28%26%5E%23%25%24+not+%27%22+corruption%21</url> <logo>plugins/Referrers/images/searchEngines/google.com.png</logo> </row> <row> diff --git a/tests/PHPUnit/System/expected/test_RowEvolution_multipleDates_lastNoData__API.getRowEvolution_month.xml b/tests/PHPUnit/System/expected/test_RowEvolution_multipleDates_lastNoData__API.getRowEvolution_month.xml index ff4f69a79d..5730859763 100644 --- a/tests/PHPUnit/System/expected/test_RowEvolution_multipleDates_lastNoData__API.getRowEvolution_month.xml +++ b/tests/PHPUnit/System/expected/test_RowEvolution_multipleDates_lastNoData__API.getRowEvolution_month.xml @@ -33,7 +33,7 @@ <change>-100%</change> </nb_visits_0> <nb_visits_1> - <name>justice )(&^#%$ not corruption! (Visits)</name> + <name>justice )(&^#%$ not &#039;" corruption! (Visits)</name> <min>0</min> <max>8</max> <change>-100%</change> diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml index 9a056e8786..5b6b0bc255 100644 --- a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_day.xml @@ -6,6 +6,12 @@ <label>_pk_scount</label> <nb_visits>4</nb_visits> <nb_actions>6</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <subtable> <row> @@ -24,6 +30,12 @@ <label>_pk_scat</label> <nb_visits>2</nb_visits> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <subtable> <row> @@ -39,6 +51,12 @@ <label>_pk_scount</label> <nb_visits>3</nb_visits> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <subtable> <row> @@ -62,6 +80,12 @@ <label>_pk_scat</label> <nb_visits>2</nb_visits> <nb_actions>2</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <subtable> <row> @@ -89,6 +113,12 @@ <label>_pk_scount</label> <nb_visits>1</nb_visits> <nb_actions>2</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <subtable> <row> @@ -102,6 +132,12 @@ <label>_pk_scat</label> <nb_visits>1</nb_visits> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <subtable> <row> @@ -130,6 +166,12 @@ <sum_visit_length>541</sum_visit_length> <bounce_count>0</bounce_count> <nb_visits_converted>0</nb_visits_converted> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==test+cvar+name</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml index 50b6b4821e..76eae7c657 100644 --- a/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml +++ b/tests/PHPUnit/System/expected/test_SiteSearch_AllSites__CustomVariables.getCustomVariables_month.xml @@ -7,6 +7,12 @@ <nb_visits>7</nb_visits> <nb_actions>9</nb_actions> <sum_daily_nb_uniq_visitors>7</sum_daily_nb_uniq_visitors> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <subtable> <row> @@ -34,6 +40,12 @@ <nb_visits>4</nb_visits> <nb_actions>5</nb_actions> <sum_daily_nb_uniq_visitors>4</sum_daily_nb_uniq_visitors> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <subtable> <row> @@ -71,6 +83,12 @@ <nb_visits>1</nb_visits> <nb_actions>2</nb_actions> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <subtable> <row> @@ -86,6 +104,12 @@ <nb_visits>1</nb_visits> <nb_actions>1</nb_actions> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <subtable> <row> @@ -116,6 +140,12 @@ <nb_visits_converted>0</nb_visits_converted> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==test+cvar+name</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml index 8428ead295..bd42dba25a 100644 --- a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml +++ b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_day.xml @@ -112,11 +112,23 @@ <reportMetadata> <result prettyDate="Sunday, January 3, 2010"> <row> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <idsubdatatable>3173</idsubdatatable> </row> <row> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <idsubdatatable>3172</idsubdatatable> @@ -124,11 +136,23 @@ </result> <result prettyDate="Monday, January 4, 2010"> <row> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <idsubdatatable>3176</idsubdatatable> </row> <row> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <idsubdatatable>3175</idsubdatatable> diff --git a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml index a849b60fd7..4d86dedf9b 100644 --- a/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml +++ b/tests/PHPUnit/System/expected/test_SiteSearch_CustomVariables.getCustomVariables_firstSite_lastN__API.getProcessedReport_month.xml @@ -81,11 +81,23 @@ <reportMetadata> <result prettyDate="January 2010"> <row> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pk_scount</segment> <idsubdatatable>3198</idsubdatatable> </row> <row> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pk_scat</segment> <idsubdatatable>3197</idsubdatatable> diff --git a/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_day.xml b/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_day.xml index 362ecce292..865d25db4e 100644 --- a/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_day.xml +++ b/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_day.xml @@ -25,7 +25,7 @@ <loops>2</loops> <pageviews>18</pageviews> <entries>4</entries> - <exits>6</exits> + <exits>7</exits> </pageMetrics> <followingPages> <row> @@ -38,7 +38,7 @@ </row> <row> <label>Others</label> - <referrals>4</referrals> + <referrals>3</referrals> </row> </followingPages> <followingSiteSearches> diff --git a/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_month.xml b/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_month.xml index 639a8ffa93..7e7b381757 100644 --- a/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_month.xml +++ b/tests/PHPUnit/System/expected/test_Transitions__Transitions.getTransitionsForPageUrl_month.xml @@ -25,7 +25,7 @@ <loops>2</loops> <pageviews>21</pageviews> <entries>4</entries> - <exits>7</exits> + <exits>9</exits> </pageMetrics> <followingPages> <row> @@ -38,7 +38,7 @@ </row> <row> <label>Others</label> - <referrals>5</referrals> + <referrals>3</referrals> </row> </followingPages> <followingSiteSearches> diff --git a/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_day.xml b/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_day.xml index c6b559a21c..6233153f1c 100644 --- a/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_day.xml +++ b/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_day.xml @@ -25,7 +25,7 @@ <loops>2</loops> <pageviews>18</pageviews> <entries>4</entries> - <exits>6</exits> + <exits>7</exits> </pageMetrics> <followingPages> <row> @@ -44,10 +44,6 @@ <label>example.org/page3.html</label> <referrals>1</referrals> </row> - <row> - <label>example.org/page/search.html</label> - <referrals>1</referrals> - </row> </followingPages> <followingSiteSearches> <row> diff --git a/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_month.xml b/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_month.xml index dd4aea11a7..c782fbb761 100644 --- a/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_month.xml +++ b/tests/PHPUnit/System/expected/test_Transitions_noLimit__Transitions.getTransitionsForPageUrl_month.xml @@ -25,7 +25,7 @@ <loops>2</loops> <pageviews>21</pageviews> <entries>4</entries> - <exits>7</exits> + <exits>9</exits> </pageMetrics> <followingPages> <row> @@ -41,10 +41,6 @@ <referrals>2</referrals> </row> <row> - <label>example.org/page/search.html</label> - <referrals>2</referrals> - </row> - <row> <label>example.org/page3.html</label> <referrals>1</referrals> </row> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html index 3ffd998150..cfb6f4e333 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html @@ -5,7 +5,7 @@ </head> <body style="font-family: dejavusans; color: rgb(13,13,13);line-height: 1.33;"> -<a id="reportTop" rel="noreferrer" target="_blank" href="http://localhost/tests/PHPUnit/proxy/"><img title="Go to Piwik" border="0" alt="Piwik" src='http://localhost/tests/PHPUnit/proxy/plugins/Morpheus/images/logo-header.png'/></a> +<a id="reportTop" rel="noreferrer" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/"><img title="Go to Piwik" border="0" alt="Piwik" src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/Morpheus/images/logo-header.png'/></a> <h1 style="font-weight:normal; color: rgb(13,13,13); font-size: 24pt;"> Site 1 @@ -2562,7 +2562,42 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Unique returning visitors </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/cookie.gif'> + + Cookie </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 11 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 100% + </td> + </tr> + + <tr style=";line-height: 22px;"> + <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/flash.gif'> + + Flash </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 11 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 100% + </td> + </tr> + + <tr style="background-color: rgb(242,242,242);line-height: 22px;"> + <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/java.gif'> + + Java </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 11 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 2 </td> @@ -2570,7 +2605,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Returning Users </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/director.gif'> + + Director </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -2578,7 +2619,16 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Returning Visits </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/gears.gif'> + + Gears </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 9 </td> @@ -2586,7 +2636,16 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Actions by Returning Visits </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/pdf.gif'> + + Pdf </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 41 </td> @@ -2594,7 +2653,16 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Maximum actions in one returning visit </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/quicktime.gif'> + + Quicktime </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 5 </td> @@ -2602,7 +2670,16 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Bounce Rate for Returning Visits </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/realplayer.gif'> + + Realplayer </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 11% </td> @@ -2610,7 +2687,16 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Avg. Actions per Returning Visit </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/silverlight.gif'> + + Silverlight </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 4.6 </td> @@ -2618,7 +2704,16 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Avg. Duration of a Returning Visit (in sec) </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/windowsmedia.gif'> + + Windowsmedia </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 00:13:21 </td> @@ -3574,7 +3669,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD 14h </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -3597,7 +3698,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD 15h </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/fr.png'> + + France </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -3666,7 +3773,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD 18h </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -3689,7 +3802,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD 19h </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -4507,7 +4626,22 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Pageviews </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/screens/unknown.gif'> + + Unknown </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 8 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 40 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 5 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 43 </td> @@ -4531,7 +4665,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Unique Downloads </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/screens/normal.gif'> + + Desktop </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 0 </td> @@ -4610,7 +4750,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD second visitor </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/UNK.gif'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 8 </td> @@ -4627,7 +4773,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD first page view </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> + + Firefox </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 2 </td> @@ -4635,6 +4787,40 @@ 2 </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD +======= + 1 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 00:00:00 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 100% + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0% + </td> + </tr> + + <tr style="background-color: rgb(242,242,242);line-height: 22px;"> + <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/OP.gif'> + + Opera </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 1 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 1 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 1 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 00:00:00 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +>>>>>>> master 100% </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -4675,7 +4861,19 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Checkout </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/brand/Unknown.ico'> + + Unknown </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 11 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 43 + </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 8 </td> @@ -4746,7 +4944,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Websites </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/UNK.gif'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 6 </td> @@ -4769,7 +4973,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Campaigns </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> + + Firefox 3.6 </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 4 </td> @@ -4792,7 +5002,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD Direct Entry </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/OP.gif'> + + Opera 9.63 </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 1 </td> @@ -4852,7 +5068,13 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD referrer.com </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/UNK.gif'> + + Unknown </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 6 </td> @@ -4875,7 +5097,13 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD goal-matching-url-parameter </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> + + Windows </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 4 </td> @@ -4945,7 +5173,38 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> +<<<<<<< HEAD referrer.com </td> +======= + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/UNK.gif'> + + Unknown </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 8 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 40 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 5 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 00:15:01 + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0% + </td> + <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + 0% + </td> + </tr> + + <tr style=";line-height: 22px;"> + <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> + + Windows XP </td> +>>>>>>> master <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> 6 </td> diff --git a/tests/PHPUnit/System/expected/test_UserId_VisitorId__Live.getLastVisitsDetails_month.xml b/tests/PHPUnit/System/expected/test_UserId_VisitorId__Live.getLastVisitsDetails_month.xml index c728abec68..b83a3d071d 100644 --- a/tests/PHPUnit/System/expected/test_UserId_VisitorId__Live.getLastVisitsDetails_month.xml +++ b/tests/PHPUnit/System/expected/test_UserId_VisitorId__Live.getLastVisitsDetails_month.xml @@ -9,7 +9,7 @@ <url>http://example.org/index.htm</url> <pageTitle>incredible title!</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 6, 2010 11:22:33 AM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 11:22:33</serverTimePretty> <pageId>1</pageId> <icon /> <timestamp>1267874553</timestamp> @@ -28,7 +28,7 @@ <url>http://example.org/index2.htm</url> <pageTitle>incredible title!</pageTitle> <pageIdAction>3</pageIdAction> - <serverTimePretty>Mar 6, 2010 11:25:33 AM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 11:25:33</serverTimePretty> <pageId>2</pageId> <timeSpent>180</timeSpent> <timeSpentPretty>3 min 0s</timeSpentPretty> @@ -40,7 +40,7 @@ <url>http://example.org/index3.htm</url> <pageTitle>incredible title!</pageTitle> <pageIdAction>4</pageIdAction> - <serverTimePretty>Mar 6, 2010 11:28:33 AM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 11:28:33</serverTimePretty> <pageId>3</pageId> <icon /> <timestamp>1267874913</timestamp> @@ -59,7 +59,7 @@ <url>http://example.org/no-user-id-set-but-should-appear-in-user-id-visit</url> <pageTitle>no User Id set but it should appear in email@example.com!</pageTitle> <pageIdAction>6</pageIdAction> - <serverTimePretty>Mar 6, 2010 1:16:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 13:16:33</serverTimePretty> <pageId>4</pageId> <timeSpent>360</timeSpent> <timeSpentPretty>6 min 0s</timeSpentPretty> @@ -71,7 +71,7 @@ <url>http://example.org/index.htm</url> <pageTitle>incredible title!</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 6, 2010 1:22:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 13:22:33</serverTimePretty> <pageId>5</pageId> <timeSpent>360</timeSpent> <timeSpentPretty>6 min 0s</timeSpentPretty> @@ -83,7 +83,7 @@ <url>http://example.org/index.htm</url> <pageTitle>second page</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 6, 2010 1:28:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 13:28:33</serverTimePretty> <pageId>6</pageId> <icon /> <timestamp>1267882113</timestamp> @@ -102,7 +102,7 @@ <url>http://example.org/index.htm</url> <pageTitle>a new user id was set -> new visit</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 6, 2010 1:34:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 13:34:33</serverTimePretty> <pageId>7</pageId> <icon /> <timestamp>1267882473</timestamp> @@ -121,7 +121,7 @@ <url>http://example.org/home</url> <pageTitle>pageview - should not be tracked by our user id but in a new visit</pageTitle> <pageIdAction>10</pageIdAction> - <serverTimePretty>Mar 6, 2010 4:28:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 16:28:33</serverTimePretty> <pageId>10</pageId> <icon /> <timestamp>1267892913</timestamp> @@ -140,7 +140,7 @@ <url>http://example.org/home</url> <pageTitle>same user id was set -> this is the same unique user</pageTitle> <pageIdAction>10</pageIdAction> - <serverTimePretty>Mar 6, 2010 4:22:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 16:22:33</serverTimePretty> <pageId>8</pageId> <timeSpent>360</timeSpent> <timeSpentPretty>6 min 0s</timeSpentPretty> @@ -152,7 +152,7 @@ <url>http://example.org/home</url> <pageTitle>second pageview - by this user id</pageTitle> <pageIdAction>10</pageIdAction> - <serverTimePretty>Mar 6, 2010 4:28:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 16:28:33</serverTimePretty> <pageId>9</pageId> <timeSpent>720</timeSpent> <timeSpentPretty>12 min 0s</timeSpentPretty> @@ -165,7 +165,7 @@ <goalId>1</goalId> <revenue>0</revenue> <goalPageId /> - <serverTimePretty>Mar 6, 2010 4:34:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 16:34:33</serverTimePretty> <url>http://example.org/home</url> <icon>plugins/Morpheus/images/goal.png</icon> <timestamp>1267893273</timestamp> @@ -174,7 +174,7 @@ <type>ecommerceAbandonedCart</type> <revenue>10000000000</revenue> <items>1</items> - <serverTimePretty>Mar 6, 2010 4:40:33 PM</serverTimePretty> + <serverTimePretty>Mar 6, 2010 16:40:33</serverTimePretty> <itemDetails> <row> <itemSKU>sku-007-PRISM</itemSKU> @@ -201,7 +201,7 @@ <url>http://example.org/index.htm</url> <pageTitle>Page view by email@example.com</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 14, 2010 11:22:33 AM</serverTimePretty> + <serverTimePretty>Mar 14, 2010 11:22:33</serverTimePretty> <pageId>11</pageId> <icon /> <timestamp>1268565753</timestamp> @@ -220,7 +220,7 @@ <url>http://example.org/index.htm</url> <pageTitle>A page view by new-user-id@one-weeklater</pageTitle> <pageIdAction>2</pageIdAction> - <serverTimePretty>Mar 14, 2010 11:46:33 AM</serverTimePretty> + <serverTimePretty>Mar 14, 2010 11:46:33</serverTimePretty> <pageId>12</pageId> <icon /> <timestamp>1268567193</timestamp> diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml index ded012ba51..1a9ff120e6 100644 --- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml +++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml @@ -67,6 +67,13 @@ <permission>1</permission> </row> <row> + <type>metric</type> + <category>Actions</category> + <name>Action Type</name> + <segment>actionType</segment> + <acceptedValues>A type of action, such as: pageviews, contents, sitesearches, events, outlinks, downloads</acceptedValues> + </row> + <row> <type>dimension</type> <category>Visit Location</category> <name>City</name> @@ -306,6 +313,13 @@ <category>Custom Variables</category> <name>Custom Variable name (scope visit)</name> <segment>customVariableName</segment> + <unionOfSegments> + <row>customVariableName1</row> + <row>customVariableName2</row> + <row>customVariableName3</row> + <row>customVariableName4</row> + <row>customVariableName5</row> + </unionOfSegments> </row> <row> <type>dimension</type> @@ -342,6 +356,13 @@ <category>Custom Variables</category> <name>Custom Variable name (scope page)</name> <segment>customVariablePageName</segment> + <unionOfSegments> + <row>customVariablePageName1</row> + <row>customVariablePageName2</row> + <row>customVariablePageName3</row> + <row>customVariablePageName4</row> + <row>customVariablePageName5</row> + </unionOfSegments> </row> <row> <type>dimension</type> @@ -378,6 +399,13 @@ <category>Custom Variables</category> <name>Custom Variable value (scope page)</name> <segment>customVariablePageValue</segment> + <unionOfSegments> + <row>customVariablePageValue1</row> + <row>customVariablePageValue2</row> + <row>customVariablePageValue3</row> + <row>customVariablePageValue4</row> + <row>customVariablePageValue5</row> + </unionOfSegments> </row> <row> <type>dimension</type> @@ -414,6 +442,13 @@ <category>Custom Variables</category> <name>Custom Variable value (scope visit)</name> <segment>customVariableValue</segment> + <unionOfSegments> + <row>customVariableValue1</row> + <row>customVariableValue2</row> + <row>customVariableValue3</row> + <row>customVariableValue4</row> + <row>customVariableValue5</row> + </unionOfSegments> </row> <row> <type>dimension</type> @@ -448,6 +483,17 @@ <row> <type>dimension</type> <category>Actions</category> + <name>Action URL</name> + <segment>actionUrl</segment> + <unionOfSegments> + <row>pageUrl</row> + <row>downloadUrl</row> + <row>outlinkUrl</row> + </unionOfSegments> + </row> + <row> + <type>dimension</type> + <category>Actions</category> <name>Clicked URL</name> <segment>outlinkUrl</segment> </row> diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml index 1d0ee64c8d..caf12153e5 100755 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml @@ -33,6 +33,12 @@ </goals> <nb_conversions>3</nb_conversions> <revenue>3121.11</revenue> + <slots> + <row> + <scope>visit</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==ValueIsZero</segment> <subtable> <row> @@ -104,6 +110,12 @@ </goals> <nb_conversions>3</nb_conversions> <revenue>3121.11</revenue> + <slots> + <row> + <scope>visit</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -146,6 +158,12 @@ <label>_pkc</label> <nb_visits>7</nb_visits> <nb_actions>12</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==_pkc</segment> <subtable> <row> @@ -191,6 +209,12 @@ <label>_pkn</label> <nb_visits>6</nb_visits> <nb_actions>11</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==_pkn</segment> <subtable> <row> @@ -216,6 +240,12 @@ <label>_pks</label> <nb_visits>6</nb_visits> <nb_actions>11</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==_pks</segment> <subtable> <row> @@ -265,6 +295,12 @@ </goals> <nb_conversions>2</nb_conversions> <revenue>3111.11</revenue> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==VisitorName</segment> <subtable> <row> @@ -302,6 +338,12 @@ <label>_pkp</label> <nb_visits>8</nb_visits> <nb_actions>8</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==_pkp</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html index b81c8a37d0..b2825b88ee 100644 --- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html +++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html @@ -5,7 +5,7 @@ </head> <body style="font-family: dejavusans; color: rgb(13,13,13);line-height: 1.33;"> -<a id="reportTop" rel="noreferrer" target="_blank" href="http://localhost/tests/PHPUnit/proxy/"><img title="Go to Piwik" border="0" alt="Piwik" src='http://localhost/tests/PHPUnit/proxy/plugins/Morpheus/images/logo-header.png'/></a> +<a id="reportTop" rel="noreferrer" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/"><img title="Go to Piwik" border="0" alt="Piwik" src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/Morpheus/images/logo-header.png'/></a> <h1 style="font-weight:normal; color: rgb(13,13,13); font-size: 24pt;"> Piwik test @@ -696,7 +696,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/screens/normal.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/screens/normal.gif'> Desktop </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -818,7 +818,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/brand/Unknown.ico'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/brand/Unknown.ico'> Unknown </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -940,7 +940,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> Windows XP </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1002,7 +1002,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> Firefox </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1064,7 +1064,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/browsers/FF.gif'> Firefox 3.6 </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1186,7 +1186,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicesDetection/images/os/WIN.gif'> Windows </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1296,7 +1296,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/cookie.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/cookie.gif'> Cookie </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1309,7 +1309,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/flash.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/flash.gif'> Flash </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1322,7 +1322,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/java.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/java.gif'> Java </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1335,7 +1335,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/director.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/director.gif'> Director </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1348,7 +1348,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/gears.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/gears.gif'> Gears </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1361,7 +1361,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/pdf.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/pdf.gif'> Pdf </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1374,7 +1374,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/quicktime.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/quicktime.gif'> Quicktime </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1387,7 +1387,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/realplayer.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/realplayer.gif'> Realplayer </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1400,7 +1400,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/silverlight.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/silverlight.gif'> Silverlight </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1413,7 +1413,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/windowsmedia.gif'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/DevicePlugins/images/plugins/windowsmedia.gif'> Windowsmedia </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1463,7 +1463,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/pl.png'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/pl.png'> Poland </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1488,7 +1488,7 @@ <tr style=";line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/fr.png'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/fr.png'> France </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1610,7 +1610,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> Unknown </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> @@ -1755,7 +1755,7 @@ <tr style="background-color: rgb(242,242,242);line-height: 22px;"> <td style="font-size: 13px; border-right: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> - <img src='http://localhost/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> + <img src='http://example.com/piwik/tests/PHPUnit/proxy/plugins/UserCountry/images/flags/xx.png'> Unknown </td> <td style="font-size: 13px; border-left: 1px solid rgb(217,217,217); padding: 5px 0 5px 5px;"> diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableExtractionDimensions.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableExtractionDimensions.xml new file mode 100644 index 0000000000..7a397597a0 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableExtractionDimensions.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>url</value> + <name>Page URL</name> + </row> + <row> + <value>urlparam</value> + <name>Page URL Parameter</name> + </row> + <row> + <value>action_name</value> + <name>Page Title</name> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableScopes.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableScopes.xml new file mode 100644 index 0000000000..149cf8b31c --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getAvailableScopes.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>visit</value> + <name>Visit</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>0</supportsExtractions> + </row> + <row> + <value>action</value> + <name>Action</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>1</supportsExtractions> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getConfiguredCustomDimensions.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getConfiguredCustomDimensions.xml new file mode 100644 index 0000000000..c234bed59e --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomDimensions.getConfiguredCustomDimensions.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result />
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml new file mode 100644 index 0000000000..81163427e5 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit_PeriodIsLast__CustomVariables.getUsagesOfSlots.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <scope>visit</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>5</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>5</index> + <usages> + </usages> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableExtractionDimensions.xml b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableExtractionDimensions.xml new file mode 100644 index 0000000000..7a397597a0 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableExtractionDimensions.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>url</value> + <name>Page URL</name> + </row> + <row> + <value>urlparam</value> + <name>Page URL Parameter</name> + </row> + <row> + <value>action_name</value> + <name>Page Title</name> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableScopes.xml b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableScopes.xml new file mode 100644 index 0000000000..149cf8b31c --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getAvailableScopes.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <value>visit</value> + <name>Visit</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>0</supportsExtractions> + </row> + <row> + <value>action</value> + <name>Action</name> + <numSlotsAvailable>5</numSlotsAvailable> + <numSlotsUsed>0</numSlotsUsed> + <numSlotsLeft>5</numSlotsLeft> + <supportsExtractions>1</supportsExtractions> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getConfiguredCustomDimensions.xml b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getConfiguredCustomDimensions.xml new file mode 100644 index 0000000000..c234bed59e --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit__CustomDimensions.getConfiguredCustomDimensions.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result />
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml b/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml new file mode 100644 index 0000000000..81163427e5 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_noVisit__CustomVariables.getUsagesOfSlots.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <scope>visit</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>visit</scope> + <index>5</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>1</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>2</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>3</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>4</index> + <usages> + </usages> + </row> + <row> + <scope>page</scope> + <index>5</index> + <usages> + </usages> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml index 595575819f..ed926db9f7 100644 --- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml +++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__CustomVariables.getCustomVariables_range.xml @@ -23,6 +23,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -88,6 +94,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -129,6 +141,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -155,6 +173,16 @@ <row> <label>Status user</label> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==Status+user</segment> <subtable> <row> @@ -189,6 +217,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -215,6 +249,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -228,6 +268,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml index 595575819f..ed926db9f7 100644 --- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml +++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__CustomVariables.getCustomVariables_range.xml @@ -23,6 +23,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -88,6 +94,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -129,6 +141,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -155,6 +173,16 @@ <row> <label>Status user</label> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==Status+user</segment> <subtable> <row> @@ -189,6 +217,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -215,6 +249,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -228,6 +268,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml index d436493f49..6ee02592b7 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting__CustomVariables.getCustomVariables_day.xml @@ -3,6 +3,12 @@ <row> <label>liked</label> <nb_actions>20</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==liked</segment> <subtable> <row> @@ -20,6 +26,12 @@ <row> <label>name</label> <nb_actions>20</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==name</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml index d436493f49..6ee02592b7 100644 --- a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQuery__CustomVariables.getCustomVariables_day.xml @@ -3,6 +3,12 @@ <row> <label>liked</label> <nb_actions>20</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==liked</segment> <subtable> <row> @@ -20,6 +26,12 @@ <row> <label>name</label> <nb_actions>20</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==name</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleEndsWith__Actions.getPageTitles_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleEndsWith__Actions.getPageTitles_day.xml new file mode 100644 index 0000000000..38eb716dff --- /dev/null +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleEndsWith__Actions.getPageTitles_day.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label> Homepage</label> + <nb_visits>2</nb_visits> + <nb_uniq_visitors>2</nb_uniq_visitors> + <nb_hits>2</nb_hits> + <sum_time_spent>360</sum_time_spent> + <entry_nb_uniq_visitors>1</entry_nb_uniq_visitors> + <entry_nb_visits>1</entry_nb_visits> + <entry_nb_actions>3</entry_nb_actions> + <entry_sum_visit_length>364</entry_sum_visit_length> + <entry_bounce_count>0</entry_bounce_count> + <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>180</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>50%</exit_rate> + </row> + <row> + <label> Profile page</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>0</sum_time_spent> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>0%</exit_rate> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleStartsWith__Actions.getPageTitles_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleStartsWith__Actions.getPageTitles_day.xml new file mode 100644 index 0000000000..7cfe228274 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageTitleStartsWith__Actions.getPageTitles_day.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label> Profile page</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>0</sum_time_spent> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>0%</exit_rate> + </row> + <row> + <label> Profile page for user *_)%</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>1</nb_hits> + <sum_time_spent>0</sum_time_spent> + <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>100%</exit_rate> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlEndsWith__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlEndsWith__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000..c64e18155a --- /dev/null +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlEndsWith__Actions.getPageUrls_day.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>user</label> + <nb_visits>1</nb_visits> + <nb_hits>2</nb_hits> + <sum_time_spent>0</sum_time_spent> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>100%</exit_rate> + <subtable> + <row> + <label>/profile</label> + <nb_visits>1</nb_visits> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_hits>2</nb_hits> + <sum_time_spent>0</sum_time_spent> + <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>100%</exit_rate> + <url>http://example.org/user/profile</url> + </row> + </subtable> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlStartsWith__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlStartsWith__Actions.getPageUrls_day.xml new file mode 100644 index 0000000000..21450c0dd4 --- /dev/null +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_SegmentPageUrlStartsWith__Actions.getPageUrls_day.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <row> + <label>/homepage</label> + <nb_visits>2</nb_visits> + <nb_uniq_visitors>2</nb_uniq_visitors> + <nb_hits>2</nb_hits> + <sum_time_spent>0</sum_time_spent> + <entry_nb_uniq_visitors>1</entry_nb_uniq_visitors> + <entry_nb_visits>1</entry_nb_visits> + <entry_nb_actions>3</entry_nb_actions> + <entry_sum_visit_length>364</entry_sum_visit_length> + <entry_bounce_count>0</entry_bounce_count> + <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors> + <exit_nb_visits>1</exit_nb_visits> + <avg_time_on_page>0</avg_time_on_page> + <bounce_rate>0%</bounce_rate> + <exit_rate>50%</exit_rate> + <url>http://example.org/homepage</url> + <segment>pageUrl==http%3A%2F%2Fexample.org%2Fhomepage</segment> + </row> +</result>
\ No newline at end of file diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml index 7de013ab81..893b862eda 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_day.xml @@ -24,6 +24,12 @@ </goals> <nb_conversions>3</nb_conversions> <revenue>1000</revenue> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -86,6 +92,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -125,6 +137,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -150,6 +168,16 @@ <row> <label>Status user</label> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==Status+user</segment> <subtable> <row> @@ -181,6 +209,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>1000</revenue> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -206,6 +240,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -218,6 +258,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> @@ -230,6 +276,12 @@ <row> <label>var1</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==var1</segment> <subtable> <row> @@ -242,6 +294,12 @@ <row> <label>var2</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==var2</segment> <subtable> <row> @@ -254,6 +312,12 @@ <row> <label>var3</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==var3</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml index 5ad33104c9..ed85668d5c 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables__CustomVariables.getCustomVariables_week.xml @@ -25,6 +25,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -90,6 +96,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -131,6 +143,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -157,6 +175,16 @@ <row> <label>Status user</label> <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> <segment>customVariableName==Status+user</segment> <subtable> <row> @@ -191,6 +219,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -217,6 +251,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -230,6 +270,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> @@ -243,6 +289,12 @@ <row> <label>var1</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==var1</segment> <subtable> <row> @@ -256,6 +308,12 @@ <row> <label>var2</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==var2</segment> <subtable> <row> @@ -269,6 +327,12 @@ <row> <label>var3</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + </slots> <segment>customVariableName==var3</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml index eec12ff442..1bfb23612e 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_day.xml @@ -24,6 +24,12 @@ </goals> <nb_conversions>3</nb_conversions> <revenue>1000</revenue> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -86,6 +92,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -109,6 +121,33 @@ </subtable> </row> <row> + <label>Status user</label> + <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> + <segment>customVariableName==Status+user</segment> + <subtable> + <row> + <label>looking at "profile page"</label> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + </row> + <row> + <label>Loggedin</label> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </subtable> + </row> + <row> <label>Value will be VERY long and truncated</label> <nb_visits>1</nb_visits> <nb_actions>3</nb_actions> @@ -125,6 +164,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -148,23 +193,6 @@ </subtable> </row> <row> - <label>Status user</label> - <nb_actions>3</nb_actions> - <segment>customVariableName==Status+user</segment> - <subtable> - <row> - <label>looking at "profile page"</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> - </row> - <row> - <label>Loggedin</label> - <nb_visits>1</nb_visits> - <nb_actions>1</nb_actions> - </row> - </subtable> - </row> - <row> <label>Othercustom value which should be truncated abcdefghijklmnopqrstuvwxyz</label> <nb_visits>2</nb_visits> <nb_actions>2</nb_actions> @@ -181,6 +209,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>1000</revenue> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -206,6 +240,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -218,6 +258,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml index fe4627f8e5..4041ca8eac 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchALL_noGoalData__CustomVariables.getCustomVariables_week.xml @@ -25,6 +25,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -90,6 +96,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -114,6 +126,35 @@ </subtable> </row> <row> + <label>Status user</label> + <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> + <segment>customVariableName==Status+user</segment> + <subtable> + <row> + <label>looking at "profile page"</label> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> + </row> + <row> + <label>Loggedin</label> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + </row> + </subtable> + </row> + <row> <label>Value will be VERY long and truncated</label> <nb_visits>1</nb_visits> <nb_actions>3</nb_actions> @@ -131,6 +172,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -155,25 +202,6 @@ </subtable> </row> <row> - <label>Status user</label> - <nb_actions>3</nb_actions> - <segment>customVariableName==Status+user</segment> - <subtable> - <row> - <label>looking at "profile page"</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> - <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> - </row> - <row> - <label>Loggedin</label> - <nb_visits>1</nb_visits> - <nb_actions>1</nb_actions> - <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> - </row> - </subtable> - </row> - <row> <label>Othercustom value which should be truncated abcdefghijklmnopqrstuvwxyz</label> <nb_visits>2</nb_visits> <nb_actions>2</nb_actions> @@ -191,6 +219,12 @@ <revenue>1000</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==Othercustom+value+which+should+be+truncated+abcdefghijklmnopqrstuvwxyz</segment> <subtable> <row> @@ -217,6 +251,12 @@ <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -230,6 +270,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml index 38cbd40db8..428f0180ae 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_day.xml @@ -19,6 +19,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -42,6 +48,33 @@ </subtable> </row> <row> + <label>Status user</label> + <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> + <segment>customVariableName==Status+user</segment> + <subtable> + <row> + <label>looking at "profile page"</label> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + </row> + <row> + <label>Loggedin</label> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + </row> + </subtable> + </row> + <row> <label>Value will be VERY long and truncated</label> <nb_visits>1</nb_visits> <nb_actions>3</nb_actions> @@ -58,6 +91,12 @@ </goals> <nb_conversions>1</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -102,6 +141,12 @@ </goals> <nb_conversions>2</nb_conversions> <revenue>0</revenue> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -138,25 +183,14 @@ </subtable> </row> <row> - <label>Status user</label> - <nb_actions>3</nb_actions> - <segment>customVariableName==Status+user</segment> - <subtable> - <row> - <label>looking at "profile page"</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> - </row> - <row> - <label>Loggedin</label> - <nb_visits>1</nb_visits> - <nb_actions>1</nb_actions> - </row> - </subtable> - </row> - <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -169,6 +203,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml index 7557e0aa02..4c0da8f95e 100644 --- a/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml +++ b/tests/PHPUnit/System/expected/test_twoVisitsWithCustomVariables_segmentMatchVisitorType__CustomVariables.getCustomVariables_week.xml @@ -20,6 +20,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE</segment> <subtable> <row> @@ -44,6 +50,35 @@ </subtable> </row> <row> + <label>Status user</label> + <nb_actions>3</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>4</index> + </row> + <row> + <scope>page</scope> + <index>5</index> + </row> + </slots> + <segment>customVariableName==Status+user</segment> + <subtable> + <row> + <label>looking at "profile page"</label> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> + </row> + <row> + <label>Loggedin</label> + <nb_visits>1</nb_visits> + <nb_actions>1</nb_actions> + <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> + </row> + </subtable> + </row> + <row> <label>Value will be VERY long and truncated</label> <nb_visits>1</nb_visits> <nb_actions>3</nb_actions> @@ -61,6 +96,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>3</index> + </row> + </slots> <segment>customVariableName==Value+will+be+VERY+long+and+truncated</segment> <subtable> <row> @@ -107,6 +148,12 @@ <revenue>0</revenue> <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> <sum_daily_nb_users>0</sum_daily_nb_users> + <slots> + <row> + <scope>visit</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==VisitorType</segment> <subtable> <row> @@ -144,27 +191,14 @@ </subtable> </row> <row> - <label>Status user</label> - <nb_actions>3</nb_actions> - <segment>customVariableName==Status+user</segment> - <subtable> - <row> - <label>looking at "profile page"</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> - <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> - </row> - <row> - <label>Loggedin</label> - <nb_visits>1</nb_visits> - <nb_actions>1</nb_actions> - <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> - </row> - </subtable> - </row> - <row> <label>Language</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>1</index> + </row> + </slots> <segment>customVariableName==Language</segment> <subtable> <row> @@ -178,6 +212,12 @@ <row> <label>SET WITH EMPTY VALUE PAGE SCOPE</label> <nb_actions>1</nb_actions> + <slots> + <row> + <scope>page</scope> + <index>2</index> + </row> + </slots> <segment>customVariableName==SET+WITH+EMPTY+VALUE+PAGE+SCOPE</segment> <subtable> <row> diff --git a/tests/PHPUnit/Unit/CommonTest.php b/tests/PHPUnit/Unit/CommonTest.php index 8aa85ed550..08931b6bfe 100644 --- a/tests/PHPUnit/Unit/CommonTest.php +++ b/tests/PHPUnit/Unit/CommonTest.php @@ -102,14 +102,6 @@ class CommonTest extends PHPUnit_Framework_TestCase */ public function testSanitizeInputValues($input, $output) { - 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, Common::sanitizeInputValues($input)); - - $this->assertTrue(@set_magic_quotes_runtime(0)); - $this->assertEquals(0, @get_magic_quotes_runtime()); - } $this->assertEquals($output, Common::sanitizeInputValues($input)); } @@ -465,39 +457,4 @@ class CommonTest extends PHPUnit_Framework_TestCase { $this->assertEquals($expected, Common::extractLanguageCodeFromBrowserLanguage($browserLanguage, $validLanguages), "test with {$browserLanguage} failed, expected {$expected}"); } - - public function testSearchEnginesDefinedCorrectly() - { - include "DataFiles/SearchEngines.php"; - - $searchEngines = array(); - foreach ($GLOBALS['Piwik_SearchEngines'] as $host => $info) { - if (isset($info[2]) && $info[2] !== false) { - $this->assertTrue(strrpos($info[2], "{k}") !== false, $host . " search URL is not defined correctly, must contain the macro {k}"); - } - - if (!array_key_exists($info[0], $searchEngines)) { - $searchEngines[$info[0]] = true; - - $this->assertTrue(strpos($host, '{}') === false, $host . " search URL is the master record and should not contain {}"); - } - - if (isset($info[3]) && $info[3] !== false) { - $this->assertTrue(is_array($info[3]) || is_string($info[3]), $host . ' encoding must be either a string or an array'); - - if (is_string($info[3])) { - $this->assertTrue(trim($info[3]) !== '', $host . ' encoding cannot be an empty string'); - $this->assertTrue(strpos($info[3], ' ') === false, $host . ' encoding cannot contain spaces'); - - } - - if (is_array($info[3])) { - $this->assertTrue(count($info[3]) > 0, $host . ' encodings cannot be an empty array'); - $this->assertTrue(strpos(serialize($info[3]), '""') === false, $host . ' encodings in array cannot be empty stringss'); - $this->assertTrue(strpos(serialize($info[3]), ' ') === false, $host . ' encodings in array cannot contain spaces'); - } - } - } - } - } diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php index c6fd94e406..057f500d18 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php @@ -96,6 +96,22 @@ class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase return $table; } + protected function _getDataTableHavingAnArrayInRowMetadata() + { + $array = array( + array(Row::COLUMNS => array('label' => 'sub1', 'count' => 1)), + array(Row::COLUMNS => array('label' => 'sub2', 'count' => 2), Row::METADATA => array('test' => 'render')), + array(Row::COLUMNS => array('label' => 'sub3', 'count' => 2), Row::METADATA => array('test' => 'renderMe', 'testArray' => 'ignore')), + array(Row::COLUMNS => array('label' => 'sub4', 'count' => 6), Row::METADATA => array('testArray' => array('do not render'))), + array(Row::COLUMNS => array('label' => 'sub5', 'count' => 2), Row::METADATA => array('testArray' => 'do ignore', 'mymeta' => 'should be rendered')), + array(Row::COLUMNS => array('label' => 'sub6', 'count' => 3), Row::METADATA => array('mymeta' => 'renderrrrrr')), + ); + + $table = new DataTable(); + $table->addRowsFromArray($array); + + return $table; + } public function testCSVTest1() { @@ -186,6 +202,25 @@ class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $actual); } + public function testCSVTest7_shouldNotRenderMetadataThatContainsAnArray() + { + $dataTable = $this->_getDataTableHavingAnArrayInRowMetadata(); + $render = new Csv(); + $render->setTable($dataTable); + $render->convertToUnicode = false; + + // the column "testArray" should be ignored and not rendered, all other columns should be assigned correctly + $expected = "label,count,metadata_test,metadata_mymeta +sub1,1,, +sub2,2,render, +sub3,2,renderMe, +sub4,6,, +sub5,2,,should be rendered +sub6,3,,renderrrrrr"; + $rendered = $render->render(); + $this->assertEquals($expected, $rendered); + } + /** * DATA OF DATATABLE_ARRAY * ------------------------- diff --git a/tests/PHPUnit/Unit/DataTable/RowTest.php b/tests/PHPUnit/Unit/DataTable/RowTest.php index e18806d2d5..bc9c49bb84 100644 --- a/tests/PHPUnit/Unit/DataTable/RowTest.php +++ b/tests/PHPUnit/Unit/DataTable/RowTest.php @@ -362,6 +362,65 @@ class RowTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->row->hasColumn('test')); } + public function test_sumRowMetadata_shouldSumMetadataAccordingToAggregationOperations() + { + $this->row->setColumn('nb_visits', 10); + $this->row->setMetadata('my_sum', 5); + $this->row->setMetadata('my_max', 4); + $this->row->setMetadata('my_array', array(array('test' => 1, 'value' => 1), array('test' => 2, 'value' => 2))); + + + $row = $this->getTestRowWithNoSubDataTable(); + $row->setColumn('nb_visits', 15); + $row->setMetadata('my_sum', 7); + $row->setMetadata('my_max', 2); + $row->setMetadata('my_array', array(array('test' => 3, 'value' => 3), array('test' => 2, 'value' => 2))); + + + $aggregations = array( + 'nosuchcolumn' => 'max', // this metadata name does not exist and should be ignored + 'my_sum' => 'sum', + 'my_max' => 'max', + 'my_array' => 'uniquearraymerge' + ); + $this->row->sumRowMetadata($row, $aggregations); + + $metadata = $this->row->getMetadata(); + $expected = array( + 'my_sum' => 12, + 'my_max' => 4, + 'my_array' => array(array('test' => 1, 'value' => 1), array('test' => 2, 'value' => 2), array('test' => 3, 'value' => 3)) + ); + $this->assertSame($expected, $metadata); + } + + public function test_sumRowMetadata_uniquearraymergeShouldUseArrayFromOtherRow_IfNoMetadataForThisRowSpecified() + { + $row = $this->getTestRowWithNoSubDataTable(); + $arrayValue = array(array('test' => 3, 'value' => 3), array('test' => 2, 'value' => 2)); + $row->setMetadata('my_array', $arrayValue); + + $aggregations = array('my_array' => 'uniquearraymerge'); + + $this->row->sumRowMetadata($row, $aggregations); + + $this->assertSame(array('my_array' => $arrayValue), $this->row->getMetadata()); + } + + public function test_sumRowMetadata_uniquearraymergeShouldUseArrayFromThisRow_IfNoMetadataForOtherRowSpecified() + { + $row = $this->getTestRowWithNoSubDataTable(); + + $arrayValue = array(array('test' => 3, 'value' => 3), array('test' => 2, 'value' => 2)); + $this->row->setMetadata('my_array', $arrayValue); + + $aggregations = array('my_array' => 'uniquearraymerge'); + + $this->row->sumRowMetadata($row, $aggregations); + + $this->assertSame(array('my_array' => $arrayValue), $this->row->getMetadata()); + } + private function assertColumnSavesValue($expectedValue, $columnName, $valueToSet) { $this->row->setColumn($columnName, $valueToSet); diff --git a/tests/PHPUnit/Unit/DateTest.php b/tests/PHPUnit/Unit/DateTest.php index ba18ce1e70..ee37aba1eb 100644 --- a/tests/PHPUnit/Unit/DateTest.php +++ b/tests/PHPUnit/Unit/DateTest.php @@ -9,8 +9,10 @@ namespace Piwik\Tests\Unit; use Exception; +use Piwik\Container\StaticContainer; use Piwik\Date; use Piwik\SettingsServer; +use Piwik\Translate; /** */ @@ -331,4 +333,34 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->assertTrue($date->isLeapYear()); } } + + + public function getLocalizedLongStrings() + { + return array( + array('en', false, '2000-01-01 16:05:52', '16:05:52'), + array('de', false, '2000-01-01 16:05:52', '16:05:52'), + array('en', true, '2000-01-01 16:05:52', '4:05:52 PM'), + array('de', true, '2000-01-01 04:05:52', '4:05:52 vorm.'), + array('zh-tw', true, '2000-01-01 04:05:52', '上午4:05:52'), + array('lt', true, '2000-01-01 16:05:52', '04:05:52 popiet'), + array('ar', true, '2000-01-01 04:05:52', '4:05:52 ص'), + ); + } + + /** + * @group Core + * @dataProvider getLocalizedLongStrings + */ + public function testGetLocalizedTimeFormats($language, $use12HourClock, $time, $shouldBe) + { + Translate::loadAllTranslations(); + StaticContainer::get('Piwik\Translation\Translator')->setCurrentLanguage($language); + StaticContainer::get('Piwik\Intl\Data\Provider\DateTimeFormatProvider')->forceTimeFormat($use12HourClock); + + $date = Date::factory($time); + + $this->assertEquals($shouldBe, $date->getLocalized(Date::TIME_FORMAT)); + Translate::reset(); + } } diff --git a/tests/PHPUnit/Unit/IPTest.php b/tests/PHPUnit/Unit/IPTest.php index 2225144557..139687f619 100644 --- a/tests/PHPUnit/Unit/IPTest.php +++ b/tests/PHPUnit/Unit/IPTest.php @@ -10,11 +10,12 @@ namespace Piwik\Tests\Unit; -use Piwik\Common; use Piwik\Config; use Piwik\IP; -use Piwik\Tests\Framework\Mock\TestConfig; +/** + * @group Core + */ class IPTest extends \PHPUnit_Framework_TestCase { /** @@ -83,7 +84,6 @@ class IPTest extends \PHPUnit_Framework_TestCase /** * @dataProvider getIpFromHeaderTestData - * @group Core */ public function testGetIpFromHeader($description, $test) { @@ -111,8 +111,6 @@ class IPTest extends \PHPUnit_Framework_TestCase } /** - * @group Core - * * @dataProvider getIpTestData */ public function testGetNonProxyIpFromHeader($ip) @@ -121,8 +119,6 @@ class IPTest extends \PHPUnit_Framework_TestCase } /** - * @group Core - * * @dataProvider getIpTestData */ public function testGetNonProxyIpFromHeader2($ip) @@ -134,8 +130,6 @@ class IPTest extends \PHPUnit_Framework_TestCase } /** - * @group Core - * * @dataProvider getIpTestData */ public function testGetNonProxyIpFromHeader3($ip) @@ -155,6 +149,20 @@ class IPTest extends \PHPUnit_Framework_TestCase } /** + * See https://github.com/piwik/piwik/issues/8721 + */ + public function testGetNonProxyIpFromHeader4_ShouldReturnDefaultIp_IfDefaultIpIsGivenMultipleTimes() + { + // 1.1.1.1 is a trusted proxy + $_SERVER['REMOTE_ADDR'] = '1.1.1.1'; + $_SERVER['HTTP_X_FORWARDED_FOR'] = $_SERVER['REMOTE_ADDR']; + $_SERVER['HTTP_CF_CONNECTING_IP'] = $_SERVER['REMOTE_ADDR']; + + $this->assertEquals('1.1.1.1', IP::getNonProxyIpFromHeader('1.1.1.1', array('HTTP_X_FORWARDED_FOR', 'HTTP_CF_CONNECTING_IP'))); + unset($_SERVER['HTTP_CF_CONNECTING_IP']); + } + + /** * Dataprovider for testGetLastIpFromList */ public function getLastIpFromListTestData() @@ -170,8 +178,6 @@ class IPTest extends \PHPUnit_Framework_TestCase } /** - * @group Core - * * @dataProvider getLastIpFromListTestData */ public function testGetLastIpFromList($csv, $expected) @@ -182,4 +188,10 @@ class IPTest extends \PHPUnit_Framework_TestCase // with excluded Ips $this->assertEquals($expected, IP::getLastIpFromList($csv . ', 10.10.10.10', array('10.10.10.10'))); } + + public function testGetLastIpFromList_shouldReturnAnEmptyString_IfMultipleIpsAreGivenButAllAreExcluded() + { + // with excluded Ips + $this->assertEquals('', IP::getLastIpFromList('10.10.10.10, 10.10.10.10', array('10.10.10.10'))); + } } diff --git a/tests/PHPUnit/Unit/Metrics/FormatterTest.php b/tests/PHPUnit/Unit/Metrics/FormatterTest.php index 0bcef84c5f..d9ccc18c6d 100644 --- a/tests/PHPUnit/Unit/Metrics/FormatterTest.php +++ b/tests/PHPUnit/Unit/Metrics/FormatterTest.php @@ -190,9 +190,9 @@ class FormatterTest extends \PHPUnit_Framework_TestCase array(100, array('1 min 40s', '00:01:40')), array(3600, array('1 hours 0 min', '01:00:00')), array(3700, array('1 hours 1 min', '01:01:40')), - array(86400 + 3600 * 10, array('1 days 10 hours', '34:00:00')), - array(86400 * 365, array('365 days 0 hours', '8760:00:00')), - array((86400 * (365.25 + 10)), array('1 years 10 days', '9006:00:00')), + array(86400 + 3600 * 10, array('1 days 10 hours', '1 days 10:00:00')), + array(86400 * 365, array('365 days 0 hours', '365 days 00:00:00')), + array((86400 * (365.25 + 10)), array('1 years 10 days', '375 days 06:00:00')), array(1.342, array('1.34s', '00:00:01.34')), array(.342, array('0.34s', '00:00:00.34')), array(.02, array('0.02s', '00:00:00.02')), @@ -202,7 +202,7 @@ class FormatterTest extends \PHPUnit_Framework_TestCase array(1.2, array('1.2s', '00:00:01.20')), array(122.1, array('2 min 2.1s', '00:02:02.10')), array(-122.1, array('-2 min 2.1s', '-00:02:02.10')), - array(86400 * -365, array('-365 days 0 hours', '-8760:00:00')) + array(86400 * -365, array('-365 days 0 hours', '-365 days 00:00:00')) ); } @@ -222,4 +222,4 @@ class FormatterTest extends \PHPUnit_Framework_TestCase SitesManagerAPI::setSingletonInstance($mock); } -}
\ No newline at end of file +} diff --git a/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php b/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php index 6d9dcc67b1..71e64863c1 100644 --- a/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php +++ b/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php @@ -72,6 +72,7 @@ class SegmentExpressionTest extends \PHPUnit_Framework_TestCase array('A==B,C==D', array('where' => " (A = ? OR C = ? )", 'bind' => array('B', 'D'))), array('A!=B;C==D', array('where' => " ( A IS NULL OR A <> ? ) AND C = ? ", 'bind' => array('B', 'D'))), array('A!=B;C==D,E!=Hello World!=', array('where' => " ( A IS NULL OR A <> ? ) AND (C = ? OR ( E IS NULL OR E <> ? ) )", 'bind' => array('B', 'D', 'Hello World!='))), + array('A=@B;C=$D', array('where' => " A LIKE ? AND C LIKE ? ", 'bind' => array('%B%', '%D'))), array('A>B', array('where' => " A > ? ", 'bind' => array('B'))), array('A<B', array('where' => " A < ? ", 'bind' => array('B'))), @@ -83,6 +84,8 @@ class SegmentExpressionTest extends \PHPUnit_Framework_TestCase array('A=@B_', array('where' => " A LIKE ? ", 'bind' => array('%B\_%'))), array('A!@B%', array('where' => " ( A IS NULL OR A NOT LIKE ? ) ", 'bind' => array('%B\%%'))), + array('A=$B%', array('where' => " A LIKE ? ", 'bind' => array('%B\%'))), + array('A=^B%', array('where' => " A LIKE ? ", 'bind' => array('B\%%'))), ); } diff --git a/tests/PHPUnit/Unit/Tracker/RequestTest.php b/tests/PHPUnit/Unit/Tracker/RequestTest.php index 3db5c22a4a..7eb38059a2 100644 --- a/tests/PHPUnit/Unit/Tracker/RequestTest.php +++ b/tests/PHPUnit/Unit/Tracker/RequestTest.php @@ -470,6 +470,25 @@ class RequestTest extends UnitTestCase $this->assertContains($needle, $cookie . ''); } + public function test_getLocalTime() + { + $request = $this->buildRequest(array('h' => '12', 'm' => '34', 's' => '3')); + $this->assertSame('12:34:03', $request->getLocalTime()); + + + $request = $this->buildRequest(array('h' => '23', 'm' => '59', 's' => '59')); + $this->assertSame('23:59:59', $request->getLocalTime()); + } + + public function test_getLocalTime_shouldReturnValidTime_whenTimeWasInvalid() + { + $request = $this->buildRequest(array('h' => '26', 'm' => '60', 's' => '333')); + $this->assertSame('00:00:00', $request->getLocalTime()); + + $request = $this->buildRequest(array('h' => '-26', 'm' => '-60', 's' => '-333')); + $this->assertSame('00:00:00', $request->getLocalTime()); + } + public function test_getIdSite() { $request = $this->buildRequest(array('idsite' => '14')); diff --git a/tests/PHPUnit/Unit/UrlHelperTest.php b/tests/PHPUnit/Unit/UrlHelperTest.php index c3cd578a65..bfdf9959aa 100644 --- a/tests/PHPUnit/Unit/UrlHelperTest.php +++ b/tests/PHPUnit/Unit/UrlHelperTest.php @@ -150,32 +150,6 @@ class UrlHelperTest extends \PHPUnit_Framework_TestCase } /** - * Dataprovider for testExtractSearchEngineInformationFromUrl - */ - public function getSearchEngineUrls() - { - return Spyc::YAMLLoad(PIWIK_PATH_TEST_TO_ROOT .'/tests/resources/extractSearchEngineInformationFromUrlTests.yml'); - } - - /** - * @dataProvider getSearchEngineUrls - * @group Core - */ - public function testExtractSearchEngineInformationFromUrl($url, $engine, $keywords) - { - $this->includeDataFilesForSearchEngineTest(); - $returnedValue = UrlHelper::extractSearchEngineInformationFromUrl($url); - - $exptectedValue = false; - - if (!empty($engine)) { - $exptectedValue = array('name' => $engine, 'keywords' => $keywords); - } - - $this->assertEquals($exptectedValue, $returnedValue); - } - - /** * Dataprovider for testGetLossyUrl */ public function getLossyUrls() @@ -203,11 +177,6 @@ class UrlHelperTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, UrlHelper::getLossyUrl($input)); } - private function includeDataFilesForSearchEngineTest() - { - include "DataFiles/SearchEngines.php"; - } - /** * @group Core */ diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php index 5eed01f806..313f8f4b6a 100644 --- a/tests/PHPUnit/bootstrap.php +++ b/tests/PHPUnit/bootstrap.php @@ -82,6 +82,7 @@ function prepareServerVariables(Config $config) $_SERVER['HTTP_HOST'] = $testConfig['http_host']; $_SERVER['REQUEST_URI'] = $testConfig['request_uri']; $_SERVER['REMOTE_ADDR'] = $testConfig['remote_addr']; + $_SERVER['SERVER_PORT'] = $testConfig['port']; } function prepareTestDatabaseConfig(Config $config) diff --git a/tests/PHPUnit/config.ini.travis.php b/tests/PHPUnit/config.ini.travis.php index 093aeaca61..0261a631e2 100644 --- a/tests/PHPUnit/config.ini.travis.php +++ b/tests/PHPUnit/config.ini.travis.php @@ -14,6 +14,7 @@ tables_prefix = [tests] request_uri = "/" +port = 3000 [database_tests] host = 127.0.0.1 diff --git a/tests/README.md b/tests/README.md index aaa18d6d34..49a4882f01 100644 --- a/tests/README.md +++ b/tests/README.md @@ -31,7 +31,7 @@ To execute the tests: 1. To install PHPUnit, run `php composer.phar install --dev` in the Piwik root directory. -2. Ensure the `[database_tests]` section in `piwik/config/config.php.ini` is set up correctly, +2. Ensure the `[database_tests]` section in `piwik/config/config.ini.php` is set up correctly, i.e. with the correct password to prevent the following error: `SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)` diff --git a/tests/UI/specs/CoreUpdaterDb_spec.js b/tests/UI/specs/CoreUpdaterDb_spec.js index 98586a7ca5..33236fda5b 100644 --- a/tests/UI/specs/CoreUpdaterDb_spec.js +++ b/tests/UI/specs/CoreUpdaterDb_spec.js @@ -18,7 +18,7 @@ describe("CoreUpdaterDb", function () { }); function apiUpgradeTest(format) { - it("should start the updater when an old version of Piwik is detected in the DB", function (done) { + it("should start the updater when an old version of Piwik is detected in the DB with format " + format, function (done) { expect.file('CoreUpdater.API.ErrorMessage' + format + '.txt').to.be.pageContents(function (page) { page.load(''); page.downloadUrl('?module=API&method=API.getPiwikVersion&format=' + format); diff --git a/tests/UI/specs/Dashboard_spec.js b/tests/UI/specs/Dashboard_spec.js index 3c6166c698..9607b126ac 100644 --- a/tests/UI/specs/Dashboard_spec.js +++ b/tests/UI/specs/Dashboard_spec.js @@ -38,11 +38,7 @@ describe("Dashboard", function () { var setup = function (done) { // make sure live widget doesn't refresh constantly for UI tests - testEnvironment.configOverride = { - General: { - 'live_widget_refresh_after_seconds': 1000000 - } - }; + testEnvironment.overrideConfig('General', 'live_widget_refresh_after_seconds', 1000000); testEnvironment.save(); // save empty layout for dashboard ID = 5 diff --git a/tests/UI/specs/Installation_spec.js b/tests/UI/specs/Installation_spec.js index 6830091da6..6aca4b0b78 100644 --- a/tests/UI/specs/Installation_spec.js +++ b/tests/UI/specs/Installation_spec.js @@ -121,6 +121,15 @@ describe("Installation", function () { }); page.click('.btn'); page.wait(3000); + + // manually remove port in tracking code, since ui-test.php won't be using the correct INI config file + page.evaluate(function () { + $('pre').each(function () { + var html = $(this).html(); + html = html.replace(/localhost\:[0-9]+/g, 'localhost'); + $(this).html(html); + }); + }); }, done); }); diff --git a/tests/UI/specs/Morpheus_spec.js b/tests/UI/specs/Morpheus_spec.js index e2dd4322e5..0a57d26540 100644 --- a/tests/UI/specs/Morpheus_spec.js +++ b/tests/UI/specs/Morpheus_spec.js @@ -12,11 +12,7 @@ describe("Morpheus", function () { before(function () { // Enable development mode - testEnvironment.configOverride = { - Development: { - enabled: true - } - }; + testEnvironment.overrideConfig('Development', 'enabled', true); testEnvironment.save(); }); diff --git a/tests/UI/specs/Overlay_spec.js b/tests/UI/specs/Overlay_spec.js index 5fb74621f5..c0adc30a43 100644 --- a/tests/UI/specs/Overlay_spec.js +++ b/tests/UI/specs/Overlay_spec.js @@ -12,6 +12,7 @@ describe("Overlay", function () { this.timeout(0); var url = null; + var urlWithSegment; function removeOptOutIframe(page) { page.evaluate(function () { @@ -20,8 +21,12 @@ describe("Overlay", function () { } before(function (done) { - url = "?module=Overlay&period=year&date=today&idSite=3#?l=" + encodeURIComponent(testEnvironment.overlayUrl).replace(/[%]/g, "$"); - + var baseUrl = '?module=Overlay&period=year&date=today&idSite=3'; + var hash = '#?l=' + encodeURIComponent(testEnvironment.overlayUrl).replace(/[%]/g, "$"); + + url = baseUrl + hash; + urlWithSegment = baseUrl + '&segment=' + encodeURIComponent('visitIp==20.56.34.67') + hash; + testEnvironment.callApi("SitesManager.addSiteAliasUrls", {idSite: 3, urls: [config.piwikUrl]}, done); }); @@ -49,6 +54,14 @@ describe("Overlay", function () { }); page.sendMouseEvent('mousemove', pos); + page.evaluate(function () { + $('div#PIS_StatusBar', $('iframe').contents()).each(function () { + var html = $(this).html(); + html = html.replace(/localhost\:[0-9]+/g, 'localhost'); + $(this).html(html); + }); + }); + removeOptOutIframe(page); }, done); }); @@ -114,4 +127,12 @@ describe("Overlay", function () { removeOptOutIframe(page); }, done); }); + + it("should load an overlay with segment", function (done) { + expect.screenshot("loaded_with_segment").to.be.capture(function (page) { + page.load(urlWithSegment); + + removeOptOutIframe(page); + }, done); + }); });
\ No newline at end of file diff --git a/tests/UI/specs/SegmentSelectorEditor_spec.js b/tests/UI/specs/SegmentSelectorEditor_spec.js index 0f53003c10..2bb5721762 100644 --- a/tests/UI/specs/SegmentSelectorEditor_spec.js +++ b/tests/UI/specs/SegmentSelectorEditor_spec.js @@ -74,7 +74,7 @@ describe("SegmentSelectorEditorTest", function () { it("should add new segment expression when segment dimension drag dropped", function (done) { expect.screenshot("dimension_drag_drop").to.be.captureSelector(selectorsToCapture, function (page) { page.click('.segmentEditorPanel .metric_category:contains(Actions)'); - page.dragDrop('.segmentEditorPanel li[data-metric=entryPageUrl]', '.segmentEditorPanel .ui-droppable'); + page.dragDrop('.segmentEditorPanel li[data-metric=actionUrl]', '.segmentEditorPanel .ui-droppable'); }, done); }); diff --git a/tests/UI/specs/Theme_spec.js b/tests/UI/specs/Theme_spec.js index 81c162b0c5..a7fffd2f30 100644 --- a/tests/UI/specs/Theme_spec.js +++ b/tests/UI/specs/Theme_spec.js @@ -20,18 +20,14 @@ describe("Theme", function () { testEnvironment.pluginsToLoad = ['ExampleTheme']; // Enable development mode to be able to see the UI demo page - testEnvironment.configOverride = { - Development: { - enabled: true - } - }; - + testEnvironment.overrideConfig('Development', 'enabled', true); testEnvironment.save(); clearAssets(); }); after(function () { + clearAssets(); }); diff --git a/tests/UI/specs/UIIntegration_spec.js b/tests/UI/specs/UIIntegration_spec.js index 972e15f23a..0849e5c8a2 100644 --- a/tests/UI/specs/UIIntegration_spec.js +++ b/tests/UI/specs/UIIntegration_spec.js @@ -30,7 +30,9 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? }); beforeEach(function () { - delete testEnvironment.configOverride; + if (testEnvironment.configOverride.database) { + delete testEnvironment.configOverride.database; + } testEnvironment.testUseMockAuth = 1; testEnvironment.save(); }); @@ -41,6 +43,7 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? testEnvironment.save(); }); + // dashboard tests it("should load dashboard1 correctly", function (done) { expect.screenshot("dashboard1").to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) { @@ -149,6 +152,15 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? }, done); }); + // actions pages + it('should load the actions > pages help tooltip, including the "Report generated time"', function (done) { + expect.screenshot('actions_pages_tooltip_help').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) { + page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls"); + page.mouseMove('h2[piwik-enriched-headline]'); + page.click(".helpIcon"); + }, done); + }); + it('should load the actions > entry pages page correctly', function (done) { expect.screenshot('actions_entry_pages').to.be.captureSelector('.pageWrap,.expandDataTableFooterDrawer', function (page) { page.load("?" + urlBase + "#?" + generalParams + "&category=General_Actions&subcategory=Actions_SubmenuPagesEntry"); @@ -512,15 +524,14 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? // DB error message it('should fail correctly when db information in config is incorrect', function (done) { - testEnvironment.configOverride = { - database: { - host: '127.50.50.50', - username: 'slkdfjsdlkfj', - password: 'slkdfjsldkfj', - dbname: 'abcdefg', - tables_prefix: 'gfedcba' - } - }; + + testEnvironment.overrideConfig('database', { + host: config.phpServer.REMOTE_ADDR, + username: 'slkdfjsdlkfj', + password: 'slkdfjsldkfj', + dbname: 'abcdefg', + tables_prefix: 'gfedcba' + }); testEnvironment.save(); expect.screenshot('db_connect_error').to.be.capture(function (page) { @@ -545,8 +556,16 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik? it('should load the widgets listing page correctly', function (done) { expect.screenshot('widgets_listing').to.be.captureSelector('.pageWrap', function (page) { page.load("?" + generalParams + "&module=Widgetize&action=index"); + page.mouseMove('.widgetpreview-categorylist>li:contains(Visitors)'); page.mouseMove('li[uniqueid="widgetVisitsSummarygetEvolutionGraphforceView1viewDataTablegraphEvolution"]'); + page.evaluate(function () { + $('.formEmbedCode').each(function () { + var val = $(this).val(); + val = val.replace(/localhost\:[0-9]+/g, 'localhost'); + $(this).val(val); + }); + }); }, done); }); diff --git a/tests/angularjs/scripts/install-ubuntu.sh b/tests/angularjs/scripts/install-ubuntu.sh index 60a564dae2..86953430d5 100755 --- a/tests/angularjs/scripts/install-ubuntu.sh +++ b/tests/angularjs/scripts/install-ubuntu.sh @@ -1,11 +1,7 @@ +#!/usr/bin/env bash DIR=`dirname $0` source $DIR/../../travis/travis-helper.sh -cd $DIR -travis_retry sudo apt-get -qq install python-software-properties -travis_retry sudo apt-add-repository -y ppa:chris-lea/node.js > /dev/null -travis_retry sudo apt-get -qq update - cd .. npm config set loglevel error travis_retry npm install .
\ No newline at end of file diff --git a/tests/angularjs/scripts/run-once.sh b/tests/angularjs/scripts/run-once.sh index 5f95af3fa5..4f796b4acb 100755 --- a/tests/angularjs/scripts/run-once.sh +++ b/tests/angularjs/scripts/run-once.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash DIR=`dirname $0` cd $DIR cd .. diff --git a/tests/angularjs/scripts/travis.sh b/tests/angularjs/scripts/travis.sh index f2002203ad..70e083a4f8 100755 --- a/tests/angularjs/scripts/travis.sh +++ b/tests/angularjs/scripts/travis.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash DIR=`dirname $0` cd $DIR ./install-ubuntu.sh diff --git a/tests/javascript/README.md b/tests/javascript/README.md index 5852407301..9e34fdff07 100644 --- a/tests/javascript/README.md +++ b/tests/javascript/README.md @@ -1,10 +1,9 @@ # JavaScript Tests ## Setup -Javascript integration tests require sqlite: - * ensure this PHP extension is enabled to make sure you run all tests apt-get install php5-sqlite - * Then please create an empty file `enable_sqlite` in `tests/javascript/enable_sqlite` - * Re-execute the tests and make sure the "missing sqlite" error message does not display +Javascript integration tests require an installed Piwik and ensure the `[database_tests]` section in `piwik/config/config.ini.php` is set up correctly, i.e. with th correct password to prevent the following error: `SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)` + +The tests will create a database named `tracker_tests` and store several tracking requests in it. ## Execute diff --git a/tests/javascript/SQLite.php b/tests/javascript/SQLite.php deleted file mode 100644 index 5b4a3b3343..0000000000 --- a/tests/javascript/SQLite.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/*! - * Piwik - free/libre analytics platform - * - * SQLite shim - * - * @link http://piwik.org - * @license http://www.opensource.org/licenses/bsd-license.php Simplified BSD - */ -if (class_exists('SQLite3')) -{ - class SQLite extends SQLite3 - { - public function __construct($filename) - { - parent::__construct($filename); - - // for backward compatibility - if (version_compare(PHP_VERSION, '5.3.3') > 0) - { - $this->busyTimeout(60000); - } - } - - public function query_array($sql) - { - $result = parent::query($sql); - - $rows = array(); - while ($res = $result->fetchArray(SQLITE3_ASSOC)) - { - $rows[] = $res; - } - return $rows; - } - } -} -else if (extension_loaded('sqlite')) -{ - class SQLite - { - private $handle; - - public function __construct($filename) - { - $this->handle = sqlite_open($filename); - } - - public function query_array($sql) - { - return sqlite_array_query($this->handle, $sql); - } - - public function exec($sql) - { - return sqlite_exec($this->handle, $sql); - } - - public function changes() - { - return sqlite_changes($this->handle); - } - - public function close() - { - sqlite_close($this->handle); - unset($this->handle); - } - } -} diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 702233d622..60d7f11558 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -5,7 +5,14 @@ <meta charset="utf-8"> <title>piwik.js: Unit Tests</title> <?php -require_once(dirname(__FILE__).'/SQLite.php'); +$root = dirname(__FILE__) . '/../..'; + +try { + $mysql = include_once $root . "/tests/PHPUnit/bootstrap.php"; +} catch (Exception $e) { + echo 'alert("' . $e->getMessage() . '")'; + $mysql = false; +} if(file_exists("stub.tpl")) { echo file_get_contents("stub.tpl"); @@ -22,17 +29,8 @@ function getHeartbeatToken() { return "<?php $token = md5(uniqid(mt_rand(), true)); echo $token; ?>"; } <?php -$sqlite = false; -if (file_exists("enable_sqlite")) { - if (class_exists('SQLite')) { - $sqlite = true; - } -} -if(!$sqlite) { - echo 'alert("WARNING: Javascript integration tests require sqlite, \n1) ensure this PHP extension is enabled to make sure you run all tests \napt-get install php5-sqlite \n2) Then please create an empty file enable_sqlite in tests/javascript/enable_sqlite \n3) Re-execute this page and make sure this popup does not display ");'; -} -if ($sqlite) { +if ($mysql) { echo ' var _paq = _paq || []; @@ -1930,7 +1928,7 @@ function PiwikTest() { }); test("API methods", function() { - expect(66); + expect(69); equal( typeof Piwik.addPlugin, 'function', 'addPlugin' ); equal( typeof Piwik.getTracker, 'function', 'getTracker' ); @@ -1959,6 +1957,9 @@ function PiwikTest() { equal( typeof tracker.setCustomData, 'function', 'setCustomData' ); equal( typeof tracker.getCustomData, 'function', 'getCustomData' ); equal( typeof tracker.setCustomRequestProcessing, 'function', 'setCustomRequestProcessing' ); + equal( typeof tracker.setCustomDimension, 'function', 'setCustomDimension' ); + equal( typeof tracker.getCustomDimension, 'function', 'getCustomDimension' ); + equal( typeof tracker.deleteCustomDimension, 'function', 'deleteCustomDimension' ); equal( typeof tracker.setCustomVariable, 'function', 'setCustomVariable' ); equal( typeof tracker.getCustomVariable, 'function', 'getCustomVariable' ); equal( typeof tracker.deleteCustomVariable, 'function', 'deleteCustomVariable' ); @@ -2241,12 +2242,48 @@ function PiwikTest() { } }); - test("Tracker setDomains() and isSiteHostName()", function() { - expect(13); + test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), findConfigCookiePathToUse() and getLinkIfShouldBeProcessed()", function() { + expect(117); var tracker = Piwik.getTracker(); + var initialDomains = tracker.getDomains(); + var domainAlias = initialDomains[0]; equal( typeof tracker.hook.test._isSiteHostName, 'function', "isSiteHostName" ); + equal( typeof tracker.hook.test._isSiteHostPath, 'function', "isSiteHostPath" ); + equal( typeof tracker.hook.test._getLinkIfShouldBeProcessed, 'function', "getLinkIfShouldBeProcessed" ); + equal( typeof tracker.hook.test._findConfigCookiePathToUse, 'function', "findConfigCookiePathToUse" ); + + var isSiteHostName = tracker.hook.test._isSiteHostName; + var isSiteHostPath = tracker.hook.test._isSiteHostPath; + var getLinkIfShouldBeProcessed = tracker.hook.test._getLinkIfShouldBeProcessed; + var findConfigCookiePathToUse = tracker.hook.test._findConfigCookiePathToUse; + + // tracker.setDomain() + + // test wildcards + tracker.setDomains( ['*.Example.com'] ); + propEqual(["*.Example.com", domainAlias], tracker.getDomains()), 'should add domainAlias'; + + tracker.setDomains( '*.Example.org' ); + propEqual(["*.Example.org", domainAlias], tracker.getDomains()), 'should handle a string'; + + tracker.setDomains( ['*.Example.com', '*.example.ORG'] ); + propEqual(["*.Example.com", '*.example.ORG', domainAlias], tracker.getDomains()), 'should be able to set many domains'; + + tracker.setDomains( [] ); + propEqual([domainAlias], tracker.getDomains()), 'setting an empty array should reset the list'; + + tracker.setDomains( ['*.Example.com', domainAlias + '/path', '*.example.ORG'] ); + propEqual(['*.Example.com', domainAlias + '/path', '*.example.ORG'], tracker.getDomains()), 'if domain alias is already given should not add domainAlias'; + + tracker.setDomains( ['.' + domainAlias + '/path'] ); + propEqual(['.' + domainAlias + '/path'], tracker.getDomains()), 'if domain alias with subdomain is already given should not add domainAlias'; + + + /** + * isSiteHostName () + */ // test wildcards tracker.setDomains( ['*.Example.com'] ); @@ -2254,21 +2291,171 @@ function PiwikTest() { // skip test if testing on localhost ok( window.location.hostname != 'localhost' ? !tracker.hook.test._isSiteHostName('localhost') : true, '!isSiteHostName("localhost")' ); - ok( !tracker.hook.test._isSiteHostName('google.com'), '!isSiteHostName("google.com")' ); - ok( tracker.hook.test._isSiteHostName('example.com'), 'isSiteHostName("example.com")' ); - ok( tracker.hook.test._isSiteHostName('www.example.com'), 'isSiteHostName("www.example.com")' ); - ok( tracker.hook.test._isSiteHostName('www.sub.example.com'), 'isSiteHostName("www.sub.example.com")' ); + ok( !isSiteHostName('google.com'), '!isSiteHostName("google.com")' ); + ok( isSiteHostName('example.com'), 'isSiteHostName("example.com")' ); + ok( isSiteHostName('www.example.com'), 'isSiteHostName("www.example.com")' ); + ok( isSiteHostName('www.sub.example.com'), 'isSiteHostName("www.sub.example.com")' ); tracker.setDomains( 'dev.piwik.org' ); - ok( !tracker.hook.test._isSiteHostName('piwik.org'), '!isSiteHostName("piwik.org")' ); - ok( tracker.hook.test._isSiteHostName('dev.piwik.org'), 'isSiteHostName("dev.piwik.org")' ); - ok( !tracker.hook.test._isSiteHostName('piwik.example.org'), '!isSiteHostName("piwik.example.org")'); - ok( !tracker.hook.test._isSiteHostName('dev.piwik.org.com'), '!isSiteHostName("dev.piwik.org.com")'); + ok( !isSiteHostName('piwik.org'), '!isSiteHostName("piwik.org")' ); + ok( isSiteHostName('dev.piwik.org'), 'isSiteHostName("dev.piwik.org")' ); + ok( !isSiteHostName('piwik.example.org'), '!isSiteHostName("piwik.example.org")'); + ok( !isSiteHostName('dev.piwik.org.com'), '!isSiteHostName("dev.piwik.org.com")'); tracker.setDomains( '.piwik.org' ); - ok( tracker.hook.test._isSiteHostName('piwik.org'), 'isSiteHostName("piwik.org")' ); - ok( tracker.hook.test._isSiteHostName('dev.piwik.org'), 'isSiteHostName("dev.piwik.org")' ); - ok( !tracker.hook.test._isSiteHostName('piwik.org.com'), '!isSiteHostName("piwik.org.com")'); + ok( isSiteHostName('piwik.org'), 'isSiteHostName("piwik.org")' ); + ok( isSiteHostName('dev.piwik.org'), 'isSiteHostName("dev.piwik.org")' ); + ok( !isSiteHostName('piwik.org.com'), '!isSiteHostName("piwik.org.com")'); + + /** + * isSiteHostPath () + */ + + // with path + tracker.setDomains( '.piwik.org/path' ); + ok( isSiteHostPath('piwik.org', '/path'), 'isSiteHostPath("piwik.org", "/path")' ); + ok( isSiteHostPath('piwik.org', '/path/'), 'isSiteHostPath("piwik.org", "/path/")' ); + ok( isSiteHostPath('piwik.org', '/path/test'), 'isSiteHostPath("piwik.org", "/path/test)' ); + ok( isSiteHostPath('dev.piwik.org', '/path'), 'isSiteHostPath("dev.piwik.org", "/path")' ); + ok( !isSiteHostPath('piwik.org', '/pat'), '!isSiteHostPath("piwik.org", "/pat")'); + ok( !isSiteHostPath('piwik.org', '.com'), '!isSiteHostPath("piwik.org", ".com")'); + ok( !isSiteHostPath('piwik.com', '/path'), '!isSiteHostPath("piwik.com", "/path")'); + ok( !isSiteHostPath('piwik.com', '/path/test'), '!isSiteHostPath("piwik.com", "/path/test")'); + ok( !isSiteHostPath('piwik.com', ''), '!isSiteHostPath("piwik.com", "/path/test")'); + + // no path + var domains = ['.piwik.org', 'piwik.org', '*.piwik.org', '.piwik.org/']; + for (var i in domains) { + var domain = domains[i]; + tracker.setDomains( domain ); + ok( isSiteHostPath('piwik.org', '/path'), 'isSiteHostPath("piwik.org", "/path"), domain: ' + domain ); + ok( isSiteHostPath('piwik.org', '/path/'), 'isSiteHostPath("piwik.org", "/path/"), domain: ' + domain ); + ok( isSiteHostPath('piwik.org', '/path/test'), 'isSiteHostPath("piwik.org", "/path/test), domain: ' + domain ); + + if (domain === 'piwik.org') { + ok( !isSiteHostPath('dev.piwik.org', '/path'), 'isSiteHostPath("dev.piwik.org", "/path"), domain: ' + domain ); + } else { + ok( isSiteHostPath('dev.piwik.org', '/path'), 'isSiteHostPath("dev.piwik.org", "/path"), domain: ' + domain ); + } + ok( isSiteHostPath('piwik.org', '/pat'), '!isSiteHostPath("piwik.org", "/pat"), domain: ' + domain ); + ok( isSiteHostPath('piwik.org', '.com'), '!isSiteHostPath("piwik.org", ".com"), domain: ' + domain); + ok( isSiteHostPath('piwik.org', '/foo'), '!isSiteHostPath("piwik.com", "/foo"), domain: ' + domain); + ok( !isSiteHostPath('piwik.com', '/path'), '!isSiteHostPath("piwik.com", "/path"), domain: ' + domain); + ok( !isSiteHostPath('piwik.com', '/path/test'), '!isSiteHostPath("piwik.com", "/path/test"), domain: ' + domain); + ok( !isSiteHostPath('piwik.com', ''), '!isSiteHostPath("piwik.com", "/path/test"), domain: ' + domain); + } + + // multiple paths / domains + tracker.setDomains( ['piwik.org/path', 'piwik.org/foo', 'piwik.org/bar/baz', '.piwik.pro/test'] ); + ok( isSiteHostPath('piwik.pro', '/test/bar'), 'isSiteHostPath("piwik.pro", "/test/bar")' ); + ok( !isSiteHostPath('piwik.org', '/foobar/'), 'isSiteHostPath("piwik.org", "/foobar/")' ); + ok( isSiteHostPath('piwik.org', '/foo/bar'), 'isSiteHostPath("piwik.org", "/foo/bar")' ); + ok( isSiteHostPath('piwik.org', '/bar/baz/foo'), 'isSiteHostPath("piwik.org", "/bar/baz/foo/")' ); + ok( !isSiteHostPath('piwik.org', '/bar/ba'), 'isSiteHostPath("piwik.org", "/bar/ba")' ); + ok( isSiteHostPath('piwik.org', '/path/test'), 'isSiteHostPath("piwik.org", "/path/test)' ); + ok( isSiteHostPath('dev.piwik.pro', '/test'), 'isSiteHostPath("dev.piwik.pro", "/test")' ); + ok( !isSiteHostPath('dev.piwik.pro', '/'), 'isSiteHostPath("dev.piwik.pro", "/")' ); + ok( !isSiteHostPath('piwik.pro', '/'), 'isSiteHostPath("piwik.pro", "/")' ); + ok( !isSiteHostPath('piwik.org', '/'), 'isSiteHostPath("piwik.org", "/")' ); + ok( !isSiteHostPath('piwik.org', '/anythingelse'), 'isSiteHostPath("piwik.org", "/anythingelse")' ); + + // all is compared lower case + tracker.setDomains( '.piwik.oRg/PaTh' ); + ok( isSiteHostPath('piwiK.org', '/pAth'), 'isSiteHostPath("piwik.org", "/path")' ); + ok( isSiteHostPath('piwik.org', '/patH/'), 'isSiteHostPath("piwik.org", "/path/")' ); + ok( isSiteHostPath('Piwik.ORG', '/PATH/TEST'), 'isSiteHostPath("piwik.org", "/path/test)' ); + + /** + * getLinkIfShouldBeProcessed () + */ + var getLinkIfShouldBeProcessed = tracker.hook.test._getLinkIfShouldBeProcessed; + function createLink(url) { + var link = document.createElement('a'); + link.href = url; + return link; + } + + tracker.setDomains( ['.piwik.org/path', '.piwik.org/foo', '.piwik.org/bar/baz', '.piwik.pro/test'] ); + + // they should not be detected as outlink as they match one of the domains + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foo/bar')), 'getLinkIfShouldBeProcessed http://www.piwik.org/foo/bar matches .piwik.org/foo') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://piwik.org/foo/bar')), 'getLinkIfShouldBeProcessed http://piwik.org/foo/bar matches .piwik.org/foo') + equal(undefined, getLinkIfShouldBeProcessed(createLink('piwik.org/foo/bar')), 'getLinkIfShouldBeProcessed missing protocol only domain given') + equal(undefined, getLinkIfShouldBeProcessed(createLink('//piwik.org/foo/bar')), 'getLinkIfShouldBeProcessed no protcol but url starts with //') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foo?x=1')), 'getLinkIfShouldBeProcessed url with query parameter should detect correct path') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foo')), 'getLinkIfShouldBeProcessed path is same as allowed path') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foo/')), 'getLinkIfShouldBeProcessed path is same as allowed path but with appended slash') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/bar/baz/')), 'getLinkIfShouldBeProcessed multiple directories with appended slash') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/bar/baz')), 'getLinkIfShouldBeProcessed multiple directories') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://WWW.PIWIK.ORG/BAR/BAZ')), 'getLinkIfShouldBeProcessed should test everything lowercase') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/bar/baz/x/y/z')), 'getLinkIfShouldBeProcessed many appended paths') + equal(undefined, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/bar/baz?test=1&foo=bar')), 'getLinkIfShouldBeProcessed another test with query parameter and multiple directories') + propEqual({ + "href": "http://www.piwik.org/foo/download.apk", + "type": "download" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foo/download.apk')), 'getLinkIfShouldBeProcessed should detect download even if it is link to same domain') + propEqual({ + "href": "http://www.piwik.org/foobar/download.apk", + "type": "download" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/foobar/download.apk')), 'getLinkIfShouldBeProcessed should detect download even if it goes to different domain/path') + propEqual({ + "href": "http://www.piwik.com/foobar/download.apk", + "type": "download" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.com/foobar/download.apk')), 'getLinkIfShouldBeProcessed should detect download even if it goes to different domain') + propEqual({ + "href": "http://www.piwik.pro/foo/", + "type": "link" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.pro/foo/')), 'getLinkIfShouldBeProcessed path matches but domain not so outlink') + propEqual({ + "href": "http://www.piwik.org/bar", + "type": "link" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/bar')), 'getLinkIfShouldBeProcessed domain matches but path not so outlink') + propEqual({ + "href": "http://www.piwik.org/footer", + "type": "link" + }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/footer')), 'getLinkIfShouldBeProcessed http://www.piwik.org/footer and there is domain piwik.org/foo but it should be outlink as path is different') + + + /** + * findConfigCookiePathToUse () + */ + + tracker.setDomains( ['.piwik.org', '.piwik.pro/foo/bar', '.piwik.pro/foo', '.piwik.com/test/foo', 'example.com/foo'] ); + + equal(null, findConfigCookiePathToUse('.piwik.org/test', 'http://piwik.org/test/two'), 'findConfigCookiePathToUse no cookiePath because there is a domain alias given allowing them all'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a match'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo'), 'findConfigCookiePathToUse should find a less restrictive path automatically, urlPath===domainPath'); + equal('/test/bar/test', findConfigCookiePathToUse('.piwik.com/test/bar/test', 'http://piwik.com/test/bar/test/'), 'findConfigCookiePathToUse should use exactly given path if no less restrictive version is available'); + equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo/test', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically, configAlias === currentUrl'); + equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); + equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/test'), 'findConfigCookiePathToUse should not return a path when user is actually not on that path'); + equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro'), 'findConfigCookiePathToUse when there is no path set we cannot use a configPath'); + + /** + * Test sets a good cookie path automatically + */ + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests'] ); + equal('/tests', tracker.getConfigCookiePath()), 'should set a cookie path automatically'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript'] ); + equal('/tests/javascript', tracker.getConfigCookiePath()), 'should set a cookie path automatically, multiple directories'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.' + domainAlias + '/tests'] ); + equal('/tests', tracker.getConfigCookiePath()), 'should find shortest path for possible cookie path'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.example.com/tests'] ); + equal('/tests/javascript', tracker.getConfigCookiePath()), 'should not find a shorter path when no other domain matches'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/another/one', '.example.org/tests/javascript', '.example.com/tests'] ); + equal(null, tracker.getConfigCookiePath()), 'should not set a path when no domain and no path matches'; + + tracker.setCookiePath(null); }); test("Tracker getClassesRegExp()", function() { @@ -2710,7 +2897,7 @@ function PiwikTest() { }); <?php -if ($sqlite) { +if ($mysql) { ?> module("request", { @@ -2727,7 +2914,7 @@ if ($sqlite) { }); test("tracking", function() { - expect(102); + expect(114); // Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL) var stopEvent = function (evt) { @@ -2783,6 +2970,21 @@ if ($sqlite) { deepEqual( tracker.getCustomVariable(5), ["new name", ""], "getting a custom variable with no value" ); tracker.deleteCustomVariable(5); + equal(tracker.getCustomDimension(94), null, "if no custom dimension for this index is specified should return null"); + equal(tracker.getCustomDimension(-1), null, "if custom dimension index is invalid should return null"); + equal(tracker.getCustomDimension('not valid'), null, "if custom dimension index is invalid should return null"); + tracker.setCustomDimension(1, 5); + equal(tracker.getCustomDimension(1), "5", "set custom dimension should convert any value to a string" ); + tracker.setCustomDimension(1, "my custom value"); + equal(tracker.getCustomDimension(1), "my custom value", "should get stored custom dimension value" ); + tracker.setCustomDimension(2, undefined); + equal(tracker.getCustomDimension(2), "", "setCustomDimension should convert undefined to an empty string" ); + + tracker.setCustomDimension(3, 'my third value'); + equal(tracker.getCustomDimension(3), "my third value", "deleteCustomDimension verify a value is set for this dimension" ); + tracker.deleteCustomDimension(3); + equal(tracker.getCustomDimension(3), null, "deleteCustomDimension verify value was removed" ); + tracker.setDocumentTitle("PiwikTest"); var referrerUrl = "http://referrer.example.com/page/sub?query=test&test2=test3"; @@ -2791,7 +2993,10 @@ if ($sqlite) { referrerTimestamp = Math.round(new Date().getTime() / 1000); tracker.trackPageView(); - tracker.trackPageView("CustomTitleTest"); + equal(tracker.getCustomDimension(1), "my custom value", "custom dimensions should not be cleared after a tracked pageview"); + equal(tracker.getCustomDimension(2), "", "custom dimensions should not be cleared after a tracked pageview"); + + tracker.trackPageView("CustomTitleTest", {dimension2: 'my new value', dimension5: 'another dimension'}); var customUrlShouldNotChangeCampaign = "http://localhost.localdomain/?utm_campaign=NONONONONONONO&utm_term=PLEASE NO!"; tracker.setCustomUrl(customUrl); @@ -3056,6 +3261,12 @@ if ($sqlite) { // Test Custom variables ok( /SaveCustomVariableCookie.*&cvar=%7B%222%22%3A%5B%22cookiename2PAGE%22%2C%22cookievalue2PAGE%22%5D%7D.*&_cvar=%7B%221%22%3A%5B%22cookiename%22%2C%22cookievalue%22%5D%2C%222%22%3A%5B%22cookiename2%22%2C%22cookievalue2%22%5D%7D/.test(results), "test custom vars are set"); + // Test CustomDimension (persistent ones across requests) + ok( /dimension1=my%20custom%20value&dimension2=&/.test(results), "test custom dimensions are set"); + + // send along a page view and ony valid for this pageview (dimension 2 overwrites another one) + ok( /dimension2=my%20new%20value&dimension5=another%20dimension&dimension1=my%20custom%20value&data=%7B%22token/.test( results ), "trackPageView(customTitle, customData)" ); + // Test campaign parameters set ok( /&_rcn=YEAH&_rck=RIGHT!/.test( results), "Test campaign parameters found"); ok( /&_ref=http%3A%2F%2Freferrer.example.com%2Fpage%2Fsub%3Fquery%3Dtest%26test2%3Dtest3/.test( results), "Test cookie Ref URL found "); diff --git a/tests/javascript/piwik.php b/tests/javascript/piwik.php index 73fbedb232..0c38317175 100644 --- a/tests/javascript/piwik.php +++ b/tests/javascript/piwik.php @@ -1,7 +1,31 @@ <?php // piwik.php test harness -require_once(dirname(__FILE__).'/SQLite.php'); +if (!defined('PIWIK_DOCUMENT_ROOT')) { + define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) . '/../..'); +} + +define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT); + + +require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php'; + +$environment = new \Piwik\Application\Environment(null); +$environment->init(); +$dbConfig = Piwik\Config::getInstance()->database_tests; +$dbConfig['dbname'] = 'tracker_tests'; + +try { + Piwik\Db::createDatabaseObject($dbConfig); +} catch (Exception $e) { + $dbInfosConnectOnly = $dbConfig; + $dbInfosConnectOnly['dbname'] = null; + Piwik\Db::createDatabaseObject($dbInfosConnectOnly); + Piwik\DbHelper::createDatabase($dbConfig['dbname']); + Piwik\Db::createDatabaseObject($dbConfig); +} + +$db = Piwik\Db::get(); function sendWebBug() { $trans_gif_64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="; @@ -14,25 +38,14 @@ function isPost() return $_SERVER['REQUEST_METHOD'] == 'POST'; } -if (!file_exists("enable_sqlite")) { +if (!Piwik\Db::hasDatabaseObject()) { sendWebBug(); exit; } -if (!class_exists('SQLite')) { - sendWebBug(); - exit; -} - -$sqlite = new SQLite( 'unittest2.dbf' ); -if (!$sqlite) { - header("HTTP/1.0 500 Internal Server Error"); - exit; -} - -function getNextRequestId($sqlite, $token) +function getNextRequestId($db, $token) { - $requests = $sqlite->query_array("SELECT uri FROM requests WHERE token = \"$token\""); + $requests = $db->fetchAll("SELECT uri FROM requests WHERE token = \"$token\""); if (empty($requests)) { return 1; @@ -41,17 +54,14 @@ function getNextRequestId($sqlite, $token) return count($requests) + 1; } -if (filesize(dirname(__FILE__).'/unittest2.dbf') == 0) -{ - try { - $query = @$sqlite->exec( 'CREATE TABLE requests (requestid TEXT, token TEXT, ip TEXT, ts TEXT, uri TEXT, referer TEXT, ua TEXT)' ); - } catch (Exception $e) { - header("HTTP/1.0 500 Internal Server Error"); - exit; - } +try { + $db->query( 'CREATE TABLE IF NOT EXISTS `requests` (requestid TEXT, token TEXT, ip TEXT, ts TEXT, uri TEXT, referer TEXT, ua TEXT) DEFAULT CHARSET=utf8' ); +} catch (Exception $e) { + header("HTTP/1.0 500 Internal Server Error"); + exit; } -function logRequest($sqlite, $uri, $data) { +function logRequest($db, $uri, $data) { $ip = $_SERVER['REMOTE_ADDR']; $ts = $_SERVER['REQUEST_TIME']; @@ -62,9 +72,9 @@ function logRequest($sqlite, $uri, $data) { $token = isset($data['token']) ? $data['token'] : ''; - $id = getNextRequestId($sqlite, $token); + $id = getNextRequestId($db, $token); - $query = $sqlite->exec("INSERT INTO requests (requestid, token, ip, ts, uri, referer, ua) VALUES (\"$id\", \"$token\", \"$ip\", \"$ts\", \"$uri\", \"$referrer\", \"$ua\")"); + $query = $db->query("INSERT INTO requests (requestid, token, ip, ts, uri, referer, ua) VALUES (\"$id\", \"$token\", \"$ip\", \"$ts\", \"$uri\", \"$referrer\", \"$ua\")"); return $query; } @@ -75,8 +85,7 @@ if (isset($_GET['requests'])) { echo "<html><head><title>$token</title></head><body>\n"; -// $result = $sqlite->query_array("SELECT uri FROM requests"); - $result = @$sqlite->query_array("SELECT uri FROM requests WHERE token = \"$token\" AND ua = \"$ua\" ORDER BY ts ASC, requestid ASC"); + $result = @$db->fetchAll("SELECT uri FROM requests WHERE token = \"$token\" AND ua = \"$ua\" ORDER BY ts ASC, requestid ASC"); if ($result !== false) { $nofRows = count($result); echo "<span>$nofRows</span>\n"; @@ -107,7 +116,7 @@ if (isset($_GET['requests'])) { $data = array('token' => $matches[1]); } - $query = $query && logRequest($sqlite, $uri . $request, $data); + $query = $query && logRequest($db, $uri . $request, $data); } } else { @@ -115,16 +124,13 @@ if (isset($_GET['requests'])) { $uri .= '?' . file_get_contents('php://input'); } - $query = logRequest($sqlite, $uri, $data); + $query = logRequest($db, $uri, $data); } if (!$query) { header("HTTP/1.0 500 Internal Server Error"); } else { -// echo 'Number of rows modified: ', $sqlite->changes(); sendWebBug(); } } } - -$sqlite->close(); diff --git a/tests/javascript/piwiktest.js b/tests/javascript/piwiktest.js index 415bd57d8a..67157c6d96 100644 --- a/tests/javascript/piwiktest.js +++ b/tests/javascript/piwiktest.js @@ -20,11 +20,14 @@ Piwik.addPlugin('testPlugin', { '_isObject : isObject,' + '_isString : isString,' + '_isSiteHostName : isSiteHostName,' + + '_isSiteHostPath : isSiteHostPath,' + '_getClassesRegExp : getClassesRegExp,' + '_hasCookies : hasCookies,' + '_getCookie : getCookie,' + '_getCookieName : getCookieName,' + '_setCookie : setCookie,' + + '_getLinkIfShouldBeProcessed : getLinkIfShouldBeProcessed,' + + '_findConfigCookiePathToUse : findConfigCookiePathToUse,' + '_encode : encodeWrapper,' + '_decode : decodeWrapper,' + '_urldecode : urldecode,' + diff --git a/tests/javascript/testrunner.js b/tests/javascript/testrunner.js index 7ac70b4a31..7194540ec8 100644 --- a/tests/javascript/testrunner.js +++ b/tests/javascript/testrunner.js @@ -22,7 +22,8 @@ // IN THE SOFTWARE var fs = require("fs"); -var url = 'http://localhost/tests/javascript/'; +var system = require("system"); +var url = system.args[1] || 'http://localhost/tests/javascript/'; function printError(message) { console.error(message + "\n"); diff --git a/tests/lib/screenshot-testing/support/app.js b/tests/lib/screenshot-testing/support/app.js index 95995797c2..51ca56ad55 100644 --- a/tests/lib/screenshot-testing/support/app.js +++ b/tests/lib/screenshot-testing/support/app.js @@ -229,7 +229,7 @@ Application.prototype.doRunTests = function () { this.runner = mocha.run(function () { // remove symlinks if (!options['keep-symlinks']) { - var symlinks = ['libs', 'plugins', 'tests', 'piwik.js']; + var symlinks = ['libs', 'plugins', 'tests', 'misc', 'piwik.js']; symlinks.forEach(function (item) { var file = path.join(uiTestsDir, '..', 'PHPUnit', 'proxy', item); diff --git a/tests/lib/screenshot-testing/support/chai-extras.js b/tests/lib/screenshot-testing/support/chai-extras.js index aeb2d86b1b..576229946e 100644 --- a/tests/lib/screenshot-testing/support/chai-extras.js +++ b/tests/lib/screenshot-testing/support/chai-extras.js @@ -181,6 +181,7 @@ function capture(screenName, compareAgainst, selector, pageSetupFn, comparisonTh child.on("exit", function (code) { if (testFailure) { testFailure = 'Processed screenshot does not match expected for ' + screenshotFileName + ' ' + testFailure; + testFailure += 'TestEnvironment was ' + JSON.stringify(testEnvironment); } if (code == 0 && !testFailure) { diff --git a/tests/lib/screenshot-testing/support/page-renderer.js b/tests/lib/screenshot-testing/support/page-renderer.js index 2bb909f721..5c92abb276 100644 --- a/tests/lib/screenshot-testing/support/page-renderer.js +++ b/tests/lib/screenshot-testing/support/page-renderer.js @@ -338,7 +338,7 @@ PageRenderer.prototype.capture = function (outputPath, callback, selector) { self.abort(); callback(new Error("Screenshot load timeout. Details:\n" + timeoutDetails)); - }, 120 * 1000); + }, 180 * 1000); if (this.webpage === null) { this._recreateWebPage(); @@ -654,6 +654,7 @@ PageRenderer.prototype._removeUrlFromQueue = function (url) { } }; +var linkObject = document.createElement('a'); PageRenderer.prototype._setupWebpageEvents = function () { var self = this; this.webpage.onError = function (message, trace) { @@ -669,11 +670,31 @@ PageRenderer.prototype._setupWebpageEvents = function () { self._logMessage(msgStack.join('\n')); }; + linkObject.setAttribute('href', config.piwikUrl); + var piwikHost = linkObject.hostname, + piwikPort = linkObject.port; + this.webpage.onResourceRequested = function (requestData, networkRequest) { - self._addUrlToQueue(requestData.url); + var url = requestData.url; + + // replaces the requested URL to the piwik URL w/ a port, if it does not have one. This allows us to run UI + // tests when Piwik is on a port, w/o having to have different UI screenshots. (This is one half of the + // solution, the other half is in config/environment/ui-test.php, where we remove all ports from Piwik URLs.) + if (piwikPort && piwikPort != 0) { + linkObject.setAttribute('href', url); + + if (linkObject.hostname == piwikHost && (!linkObject.port || linkObject.port == 0 || linkObject.port == 80)) { + linkObject.port = piwikPort; + url = linkObject.href; + + networkRequest.changeUrl(url); + } + } + + self._addUrlToQueue(url); if (VERBOSE) { - self._logMessage('Requesting resource (#' + requestData.id + 'URL:' + requestData.url + ')'); + self._logMessage('Requesting resource (#' + requestData.id + 'URL:' + url + ')'); } }; diff --git a/tests/lib/screenshot-testing/support/test-environment.js b/tests/lib/screenshot-testing/support/test-environment.js index 700493f933..01914c8c24 100644 --- a/tests/lib/screenshot-testing/support/test-environment.js +++ b/tests/lib/screenshot-testing/support/test-environment.js @@ -25,6 +25,7 @@ TestingEnvironment.prototype.reload = function () { this['useOverrideJs'] = true; this['loadRealTranslations'] = true; // UI tests should test w/ real translations, not translation keys this['testUseMockAuth'] = true; + this['configOverride'] = {}; if (fs.exists(testingEnvironmentOverridePath)) { var data = JSON.parse(fs.read(testingEnvironmentOverridePath)); @@ -34,6 +35,33 @@ TestingEnvironment.prototype.reload = function () { } }; +/** + * Overrides a config entry. + * + * You can use this method either to set one specific config value `overrideConfig(group, name, value)` + * or you can set a whole group of values `overrideConfig(group, valueObject)`. + */ +TestingEnvironment.prototype.overrideConfig = function (group, name, value) { + if (!name) { + return; + } + + if (!this['configOverride']) { + this['configOverride'] = {}; + } + + if ((typeof value) === 'undefined') { + this['configOverride'][group] = name; + return; + } + + if (!this['configOverride'][group]) { + this['configOverride'][group] = {}; + } + + this['configOverride'][group][name] = value; +}; + TestingEnvironment.prototype.save = function () { var copy = {}; for (var key in this) { diff --git a/tests/travis b/tests/travis -Subproject 2a41a93a776f5f053c8dd34c029061e1cd4d6a6 +Subproject 73a4b16ebb9a5db23bca53115195e8317ce6917 |