diff options
author | diosmosis <benaka@piwik.pro> | 2014-09-09 12:28:39 +0400 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-09-09 16:29:46 +0400 |
commit | 8dd69956cf30bb65c8e261ffac2d6c0b1be9a993 (patch) | |
tree | 97bc6e668b31dd2949a20502a4efef9221ca107c /tests/PHPUnit/Integration | |
parent | 482e797236ff984d450dbf5802f7148bdc40d94b (diff) |
Refs #6079, add tests for cross website unique visitor aggregation.
Diffstat (limited to 'tests/PHPUnit/Integration')
3 files changed, 86 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/MultipleSitesArchivingTest.php b/tests/PHPUnit/Integration/MultipleSitesArchivingTest.php new file mode 100644 index 0000000000..06c366dbe5 --- /dev/null +++ b/tests/PHPUnit/Integration/MultipleSitesArchivingTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Tests\Integration; + +use Piwik\Config; +use Piwik\Piwik; +use Piwik\Tests\Fixture; +use Piwik\Tests\Fixtures\ThreeSitesWithSharedVisitors; +use Piwik\Tests\IntegrationTestCase; + +/** + * @group Integration + * @group MultipleSitesArchivingTest + */ +class MultipleSitesArchivingTest extends IntegrationTestCase +{ + public static $fixture = null; // initialized below class definition + + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + $extraSite = Fixture::createWebsite(self::$fixture->dateTime, $ecommerce = 1, "the site"); + + Piwik::addAction("ArchiveProcessor.Parameters.getIdSites", function (&$sites, $period) use ($extraSite) { + if (reset($sites) == $extraSite) { + $sites = array(1, 2, 3); + } + }); + + Config::getInstance()->General['enable_processing_unique_visitors_multiple_sites'] = 0; + } + + public function getApiForTesting() + { + $dateTime = self::$fixture->dateTime; + + return array( + array('VisitsSummary.get', array('idSite' => 4, + 'date' => $dateTime, + 'periods' => array('day', 'month'), + 'testSuffix' => '_sitesGroup')), + ); + } + + /** + * @dataProvider getApiForTesting + */ + public function testApi($api, $params) + { + $this->runApiTests($api, $params); + } +} + +MultipleSitesArchivingTest::$fixture = new ThreeSitesWithSharedVisitors();
\ No newline at end of file diff --git a/tests/PHPUnit/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_day.xml b/tests/PHPUnit/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_day.xml new file mode 100644 index 0000000000..3cdd6ab92e --- /dev/null +++ b/tests/PHPUnit/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_day.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_uniq_visitors>3</nb_uniq_visitors> + <nb_visits>5</nb_visits> + <nb_actions>5</nb_actions> + <nb_visits_converted>0</nb_visits_converted> + <bounce_count>5</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/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_month.xml b/tests/PHPUnit/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_month.xml new file mode 100644 index 0000000000..3cdd6ab92e --- /dev/null +++ b/tests/PHPUnit/Integration/expected/test_MultipleSitesArchivingTest_sitesGroup__VisitsSummary.get_month.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_uniq_visitors>3</nb_uniq_visitors> + <nb_visits>5</nb_visits> + <nb_actions>5</nb_actions> + <nb_visits_converted>0</nb_visits_converted> + <bounce_count>5</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 |