Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2021-02-05 01:22:11 +0300
committerGitHub <noreply@github.com>2021-02-05 01:22:11 +0300
commit490dc3a1a09e4263b4893cbbbf600ba505d9add4 (patch)
tree2fca42614fec12907ecac1ae217e1305baa4144a /tests
parentbc53bc36ebebfe50d83d6ce381aa8bb6cd2cb15c (diff)
Refactor segment re-archiving in past behavior to be on demand (#17005)
* Invalidate past archives on demand when adding/updating segments, rather than trying to check when running core:archive * start on rewriting test * rewrite SegmentArchivingTest and get to pass * get sites as superuser * add update to rearchive segments if they were created/update between last archive time and update time * remove unused parameter * fix build * fix tests * sanity check * fix bug, we should not forget archives to invalidate unless all related archives are being invalidated * fix tests and make fix more complete * fix test * update counts in test * fix test for last time hopefully * fix another test * remove debugging code
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Integration/CronArchive/SegmentArchivingTest.php308
-rw-r--r--tests/PHPUnit/Integration/CronArchiveTest.php31
-rw-r--r--tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php26
-rw-r--r--tests/PHPUnit/Integration/PluginTest.php6
-rw-r--r--tests/PHPUnit/System/ArchiveInvalidationTest.php5
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__Actions.getPageUrls_day.xml173
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__VisitsSummary.get_day.xml20
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__Actions.getPageUrls_day.xml74
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__VisitsSummary.get_day.xml12
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__Actions.getPageUrls_day.xml157
-rw-r--r--tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__VisitsSummary.get_day.xml20
11 files changed, 512 insertions, 320 deletions
diff --git a/tests/PHPUnit/Integration/CronArchive/SegmentArchivingTest.php b/tests/PHPUnit/Integration/CronArchive/SegmentArchivingTest.php
index 2eb1790980..919c063c37 100644
--- a/tests/PHPUnit/Integration/CronArchive/SegmentArchivingTest.php
+++ b/tests/PHPUnit/Integration/CronArchive/SegmentArchivingTest.php
@@ -22,294 +22,102 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
*/
class SegmentArchivingTest extends IntegrationTestCase
{
- const TEST_NOW = '2015-03-01';
-
- private $mockSegmentEntries;
-
- public function setUp(): void
+ protected static function beforeTableDataCached()
{
- parent::setUp();
-
- Config::getInstance()->General['enabled_periods_API'] = 'day,week,month,year,range';
-
- Site::setSites([
- 1 => [
- 'idsite' => 1,
- 'ts_created' => '2013-03-03 00:00:00',
- ],
- ]);
-
- $this->mockSegmentEntries = array(
- array(
- 'ts_created' => '2014-01-01',
- 'definition' => 'browserName==FF',
- 'enable_only_idsite' => 1,
- 'ts_last_edit' => '2014-05-05 00:22:33',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2014-01-01',
- 'definition' => 'countryCode==us',
- 'enable_only_idsite' => 1,
- 'ts_last_edit' => '2014-02-02 00:33:44',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2012-01-01',
- 'definition' => 'countryCode==us',
- 'enable_only_idsite' => 1,
- 'ts_last_edit' => '2014-02-03',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2014-01-01',
- 'definition' => 'countryCode==ca',
- 'enable_only_idsite' => 2,
- 'ts_last_edit' => '2013-01-01',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2012-01-01',
- 'definition' => 'countryCode==ca',
- 'enable_only_idsite' => 2,
- 'ts_last_edit' => '2011-01-01',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2012-01-01',
- 'definition' => 'countryCode==br',
- 'enable_only_idsite' => 2,
- 'ts_last_edit' => '2011-01-01',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2011-01-01',
- 'definition' => 'countryCode==ca',
- 'enable_only_idsite' => 0,
- 'ts_last_edit' => null,
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2015-03-01',
- 'definition' => 'pageUrl==a',
- 'enable_only_idsite' => 1,
- 'ts_last_edit' => '2014-01-01',
- 'auto_archive' => 1,
- ),
-
- array(
- 'ts_created' => '2015-02-01',
- 'definition' => 'pageUrl==b',
- 'enable_only_idsite' => 1,
- 'ts_last_edit' => null,
- 'auto_archive' => 1,
- ),
- );
-
- Date::$now = strtotime('2020-01-30 00:00:00');
+ parent::beforeTableDataCached();
+ Fixture::createWebsite('2020-01-04 12:00:00');
}
/**
- * @dataProvider getTestDataForGetSegmentArchivesToInvalidateForNewSegments
+ * @dataProvider getTestDataForGetReArchiveSegmentStartDate
*/
- public function test_getSegmentArchivesToInvalidateForNewSegments_returnsAllSegments_IfInvalidationHasNotRun($processFrom, $idSite, $expected)
+ public function test_getReArchiveSegmentStartDate($processNewSegmentFrom, $segmentInfo, $expected)
{
- $archiving = $this->createUrlProviderToTest($processFrom);
- $segments = $archiving->getSegmentArchivesToInvalidateForNewSegments($idSite);
- $this->getStringDates($segments);
- $this->assertEquals($expected, $segments);
+ Date::$now = strtotime('2020-10-12 13:45:00');
+
+ Config::getInstance()->General['process_new_segments_from'] = $processNewSegmentFrom;
+
+ $segmentArchiving = new SegmentArchiving();
+ $result = $segmentArchiving->getReArchiveSegmentStartDate($segmentInfo);
+ if (!empty($result)) {
+ $result = $result->toString();
+ }
+ $this->assertEquals($expected, $result);
}
- public function getTestDataForGetSegmentArchivesToInvalidateForNewSegments()
+ public function getTestDataForGetReArchiveSegmentStartDate()
{
return [
+ // no segment creation time
[
- 'beginning_of_time',
- 1,
- [
- [
- 'date' => '2013-03-03 00:00:00',
- 'segment' => 'browserName==FF',
- ],
- [
- 'date' => '2013-03-03 00:00:00',
- 'segment' => 'countryCode==us',
- ],
- [
- 'date' => '2013-03-03 00:00:00',
- 'segment' => 'countryCode==ca',
- ],
- [
- 'date' => '2013-03-03 00:00:00',
- 'segment' => 'pageUrl==a',
- ],
- [
- 'date' => '2013-03-03 00:00:00',
- 'segment' => 'pageUrl==b',
- ],
- ],
+ SegmentArchiving::CREATION_TIME,
+ [],
+ null,
],
+ // creation time
[
- 'segment_creation_time',
- 1,
- [
- [
- 'date' => '2014-01-01 00:00:00',
- 'segment' => 'browserName==FF',
- ],
- [
- 'date' => '2014-01-01 00:00:00',
- 'segment' => 'countryCode==us',
- ],
- [
- 'date' => '2011-01-01 00:00:00',
- 'segment' => 'countryCode==ca',
- ],
- [
- 'date' => '2015-03-01 00:00:00',
- 'segment' => 'pageUrl==a',
- ],
- [
- 'date' => '2015-02-01 00:00:00',
- 'segment' => 'pageUrl==b',
- ],
- ],
+ SegmentArchiving::CREATION_TIME,
+ ['ts_created' => '2020-04-12 03:34:55'],
+ '2020-04-12',
],
+ // last edit time
[
- 'segment_last_edit_time',
- 1,
- [
- [
- 'date' => '2014-05-05 00:22:33',
- 'segment' => 'browserName==FF',
- ],
- [
- 'date' => '2014-02-02 00:33:44',
- 'segment' => 'countryCode==us',
- ],
- [
- 'date' => '2011-01-01 00:00:00',
- 'segment' => 'countryCode==ca',
- ],
- [
- 'date' => '2015-03-01 00:00:00',
- 'segment' => 'pageUrl==a',
- ],
- [
- 'date' => '2015-02-01 00:00:00',
- 'segment' => 'pageUrl==b',
- ],
- ],
+ SegmentArchiving::LAST_EDIT_TIME,
+ ['ts_created' => '2020-02-02 03:00:00', 'ts_last_edit' => '2020-04-13 05:15:15'],
+ '2020-04-13',
],
+ // last edit time, no edit time in segment
[
- 'segment_last_edit_time',
- 2,
- [
- [
- 'date' => '2014-01-01 00:00:00',
- 'segment' => 'countryCode==ca',
- ],
- [
- 'date' => '2012-01-01 00:00:00',
- 'segment' => 'countryCode==br',
- ],
- ],
+ SegmentArchiving::LAST_EDIT_TIME,
+ ['ts_created' => '2020-04-14 00:00:00'],
+ '2020-04-14',
],
- ];
- }
-
- public function test_getSegmentArchivesToInvalidateForNewSegments_returnsSegmentsRecentlyCreated_IfInvalidationHasRun()
- {
- Option::set(CronArchive::CRON_INVALIDATION_TIME_OPTION_NAME, strtotime('2013-12-30 00:00:00'));
- $archiving = $this->createUrlProviderToTest('beginning_of_time');
- $segments = $archiving->getSegmentArchivesToInvalidateForNewSegments(1);
- $this->getStringDates($segments);
-
- $expected = [
- [
- 'segment' => 'browserName==FF',
- 'date' => '2013-03-03 00:00:00',
- ],
+ // lastN
[
- 'segment' => 'countryCode==us',
- 'date' => '2013-03-03 00:00:00',
+ 'last30',
+ ['ts_created' => '2020-06-12'],
+ '2020-05-13',
],
+
+ // beginning of time
[
- 'segment' => 'pageUrl==a',
- 'date' => '2013-03-03 00:00:00',
+ SegmentArchiving::BEGINNING_OF_TIME,
+ ['ts_created' => '2020-06-12'],
+ '2013-01-01',
],
+
+ // beginning of time (unreadable value)
[
- 'segment' => 'pageUrl==b',
- 'date' => '2013-03-03 00:00:00',
+ 'aslkdfjsdlkjf',
+ ['ts_created' => '2020-06-12'],
+ '2013-01-01',
],
];
- $this->assertEquals($expected, $segments);
}
- public function test_getSegmentArchivesToInvalidateForNewSegments_returnsNoSegments_IfInvalidationHasRunAndAllSegmentsCreatedBefore()
+ public function test_getReArchiveSegmentStartDate_whenSiteCreationDateIsLater()
{
- Option::set(CronArchive::CRON_INVALIDATION_TIME_OPTION_NAME, strtotime('2019-12-30 00:00:00'));
-
- $archiving = $this->createUrlProviderToTest('beginning_of_time');
- $segments = $archiving->getSegmentArchivesToInvalidateForNewSegments(1);
- $this->getStringDates($segments);
-
- $expected = [];
- $this->assertEquals($expected, $segments);
- }
-
- public function test_getSegmentArchivesToInvalidateForNewSegments_usesLastArchiveFinishTimeIfInvalidationTimeMissing()
- {
- Option::set(CronArchive::OPTION_ARCHIVING_FINISHED_TS, strtotime('2013-12-30 00:00:00'));
-
- $archiving = $this->createUrlProviderToTest('beginning_of_time');
- $segments = $archiving->getSegmentArchivesToInvalidateForNewSegments(1);
- $this->getStringDates($segments);
-
- $expected = [
- [
- 'segment' => 'browserName==FF',
- 'date' => '2013-03-03 00:00:00',
- ],
- [
- 'segment' => 'countryCode==us',
- 'date' => '2013-03-03 00:00:00',
- ],
- [
- 'segment' => 'pageUrl==a',
- 'date' => '2013-03-03 00:00:00',
- ],
- [
- 'segment' => 'pageUrl==b',
- 'date' => '2013-03-03 00:00:00',
- ],
- ];
- $this->assertEquals($expected, $segments);
+ $segmentInfo = ['ts_created' => '2019-05-03 00:00:00', 'enable_only_idsite' => 1];
+ $this->test_getReArchiveSegmentStartDate(SegmentArchiving::BEGINNING_OF_TIME, $segmentInfo, '2020-01-03');
}
- private function createUrlProviderToTest($processNewSegmentsFrom, $mockData = null)
+ public function test_getReArchiveSegmentStartDate_whenEarliestVisitTimeIsLater()
{
- $mockSegmentEditorModel = $this->createPartialMock('Piwik\Plugins\SegmentEditor\Model', array('getAllSegmentsAndIgnoreVisibility'));
- $mockSegmentEditorModel->expects($this->any())->method('getAllSegmentsAndIgnoreVisibility')->will($this->returnValue($mockData ?: $this->mockSegmentEntries));
+ $t = Fixture::getTracker(1, '2020-02-05 03:00:00');
+ $t->setUrl('http://abc.com');
+ Fixture::checkResponse($t->doTrackPageView('abc'));
- return new SegmentArchiving($processNewSegmentsFrom, $beginningOfTimeLastN = 7, $mockSegmentEditorModel, null, Date::factory(self::TEST_NOW));
+ $segmentInfo = ['ts_created' => '2019-05-03 00:00:00', 'enable_only_idsite' => 1];
+ $this->test_getReArchiveSegmentStartDate(SegmentArchiving::BEGINNING_OF_TIME, $segmentInfo, '2020-02-05');
}
- private function getStringDates(array &$entries)
+ protected static function configureFixture($fixture)
{
- foreach ($entries as &$entry) {
- $entry['date'] = $entry['date']->getDatetime();
- }
+ parent::configureFixture($fixture);
+ $fixture->createSuperUser = true;
}
} \ No newline at end of file
diff --git a/tests/PHPUnit/Integration/CronArchiveTest.php b/tests/PHPUnit/Integration/CronArchiveTest.php
index 2fc991e7b4..06c93187d2 100644
--- a/tests/PHPUnit/Integration/CronArchiveTest.php
+++ b/tests/PHPUnit/Integration/CronArchiveTest.php
@@ -544,7 +544,7 @@ class CronArchiveTest extends IntegrationTestCase
$api = API::getInstance();
- $cronarchive = new TestCronArchive(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php');
+ $cronarchive = new TestCronArchive();
$cronarchive->init();
$cronarchive->setApiToInvalidateArchivedReport($api);
$cronarchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain(1);
@@ -588,7 +588,7 @@ class CronArchiveTest extends IntegrationTestCase
$allSegments = $segments->getSegmentsToAutoArchive(1);
- $cronarchive = new TestCronArchive(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php');
+ $cronarchive = new TestCronArchive();
$this->assertTrue($cronarchive->wasSegmentChangedRecently('actions>=1', $allSegments));
// created 30 hours ago...
@@ -615,7 +615,7 @@ class CronArchiveTest extends IntegrationTestCase
$logger = new FakeLogger();
- $archiver = new CronArchive(null, $logger);
+ $archiver = new CronArchive($logger);
$archiver->init();
$archiveFilter = new CronArchive\ArchiveFilter();
$archiveFilter->setSkipSegmentsForToday(true);
@@ -626,7 +626,6 @@ class CronArchiveTest extends IntegrationTestCase
$archiver->run();
self::assertStringContainsString('Will skip segments archiving for today unless they were created recently', $logger->output);
- self::assertStringContainsString('Segment "actions>=1" was created or changed recently and will therefore archive today', $logger->output);
self::assertStringNotContainsString('Segment "actions>=2" was created recently', $logger->output);
}
@@ -660,7 +659,7 @@ class CronArchiveTest extends IntegrationTestCase
$logger = new FakeLogger();
- $archiver = new CronArchive(null, $logger);
+ $archiver = new CronArchive($logger);
$archiveFilter = new CronArchive\ArchiveFilter();
$archiveFilter->setSegmentsToForce(['actions>=2;browserCode=FF', 'actions>=2']);
@@ -695,34 +694,32 @@ Checking for queued invalidations...
Will invalidate archived reports for 2019-12-02 for following websites ids: 1
Today archive can be skipped due to no visits for idSite = 1, skipping invalidation...
Yesterday archive can be skipped due to no visits for idSite = 1, skipping invalidation...
- Segment "actions>=2" was created or changed recently and will therefore archive today (for site ID = 1)
- Segment "actions>=4" was created or changed recently and will therefore archive today (for site ID = 1)
Done invalidating
-Processing invalidation: [idinvalidation = 9, idsite = 1, period = day(2019-12-12 - 2019-12-12), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
-Processing invalidation: [idinvalidation = 15, idsite = 1, period = day(2019-12-11 - 2019-12-11), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
-Processing invalidation: [idinvalidation = 18, idsite = 1, period = day(2019-12-10 - 2019-12-10), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 269, idsite = 1, period = day(2019-12-12 - 2019-12-12), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 268, idsite = 1, period = day(2019-12-11 - 2019-12-11), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 267, idsite = 1, period = day(2019-12-10 - 2019-12-10), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-12&format=json&segment=actions%3E%3D2&trigger=archivephp
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-11&format=json&segment=actions%3E%3D2&trigger=archivephp
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-10&format=json&segment=actions%3E%3D2&trigger=archivephp
Archived website id 1, period = day, date = 2019-12-12, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
Archived website id 1, period = day, date = 2019-12-11, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
Archived website id 1, period = day, date = 2019-12-10, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
-Processing invalidation: [idinvalidation = 10, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
-Processing invalidation: [idinvalidation = 25, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 266, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 257, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
No next invalidated archive.
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=week&date=2019-12-09&format=json&segment=actions%3E%3D2&trigger=archivephp
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-02&format=json&segment=actions%3E%3D2&trigger=archivephp
Archived website id 1, period = week, date = 2019-12-09, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
Archived website id 1, period = day, date = 2019-12-02, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
-Processing invalidation: [idinvalidation = 26, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 258, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
No next invalidated archive.
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=week&date=2019-12-02&format=json&segment=actions%3E%3D2&trigger=archivephp
Archived website id 1, period = week, date = 2019-12-02, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
-Processing invalidation: [idinvalidation = 11, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 256, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
No next invalidated archive.
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=month&date=2019-12-01&format=json&segment=actions%3E%3D2&trigger=archivephp
Archived website id 1, period = month, date = 2019-12-01, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
-Processing invalidation: [idinvalidation = 12, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
+Processing invalidation: [idinvalidation = 65, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f, segment = actions>=2].
No next invalidated archive.
Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=year&date=2019-01-01&format=json&segment=actions%3E%3D2&trigger=archivephp
Archived website id 1, period = year, date = 2019-01-01, segment = 'actions>=2', 0 visits found. Time elapsed: %fs
@@ -777,7 +774,7 @@ LOG;
$sequence = new Sequence(ArchiveTableCreator::getNumericTable(Date::factory('2019-12-10')));
$sequence->create();
- $archiver = new CronArchive(null, $logger);
+ $archiver = new CronArchive($logger);
$archiveFilter = new CronArchive\ArchiveFilter();
$archiver->setArchiveFilter($archiveFilter);
@@ -867,7 +864,7 @@ LOG;
$logger = new FakeLogger();
- $archiver = new CronArchive(null, $logger);
+ $archiver = new CronArchive($logger);
$archiver->shouldArchiveSpecifiedSites = array(99999, 1);
$archiver->init();
$archiver->run();
diff --git a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
index 8d1e75db00..f71d63f54d 100644
--- a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
+++ b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
@@ -97,8 +97,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$items = $list->getAll();
$expected = [
- '{"idSites":[1],"pluginName":"ExamplePlugin","report":null,"startDate":null}',
- '{"idSites":[1,4,5],"pluginName":"MyOtherPlugin","report":null,"startDate":null}',
+ '{"idSites":[1],"pluginName":"ExamplePlugin","report":null,"startDate":null,"segment":null}',
+ '{"idSites":[1,4,5],"pluginName":"MyOtherPlugin","report":null,"startDate":null,"segment":null}',
];
$this->assertEquals($expected, $items);
@@ -115,7 +115,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$items = $list->getAll();
$expected = [
- '{"idSites":[1,4,5],"pluginName":"MyOtherPlugin","report":null,"startDate":null}',
+ '{"idSites":[1,4,5],"pluginName":"MyOtherPlugin","report":null,"startDate":null,"segment":null}',
];
$this->assertEquals($expected, $items);
@@ -149,8 +149,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$items = $list->getAll();
$expected = [
- '{"idSites":[1,4,5],"pluginName":"ExamplePlugin","report":null,"startDate":null}',
- '{"idSites":[1,4,5],"pluginName":"ExamplePlugin","report":"myOtherReport","startDate":null}',
+ '{"idSites":[1,4,5],"pluginName":"ExamplePlugin","report":null,"startDate":null,"segment":null}',
+ '{"idSites":[1,4,5],"pluginName":"ExamplePlugin","report":"myOtherReport","startDate":null,"segment":null}',
];
$this->assertEquals($expected, $items);
@@ -404,7 +404,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$this->assertSameReports($expected, $reports);
}
- public function test_markArchivesAsInvalidated_shouldForgetInvalidatedSitesAndDates()
+ public function test_markArchivesAsInvalidated_shouldForgetInvalidatedSitesAndDates_IfPeriodIsDay()
{
$this->rememberReportsForManySitesAndDates();
@@ -415,7 +415,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
Date::factory('2010-10-10'),
);
- $this->invalidator->markArchivesAsInvalidated($idSites, $dates, 'week');
+ $this->invalidator->markArchivesAsInvalidated($idSites, $dates, 'day');
$reports = $this->invalidator->getRememberedArchivedReportsThatShouldBeInvalidated();
$expected = array(
@@ -1651,8 +1651,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
'period' => '1',
'name' => 'done5f4f9bafeda3443c3c2d4b2ef4dffadc.VisitsSummary',
'report' => 'some.Report',
- 'dates' => '2020-05-04,2020-05-04|2020-05-05,2020-05-05|2020-05-06,2020-05-06|2020-05-07,2020-05-07|2020-05-08,2020-05-08|2020-05-09,2020-05-09|2020-05-10,2020-05-10|2020-05-11,2020-05-11|2020-05-12,2020-05-12|2020-05-13,2020-05-13|2020-05-14,2020-05-14|2020-05-15,2020-05-15|2020-05-16,2020-05-16|2020-05-17,2020-05-17|2020-05-18,2020-05-18|2020-05-19,2020-05-19|2020-05-20,2020-05-20|2020-05-21,2020-05-21|2020-05-22,2020-05-22|2020-05-23,2020-05-23|2020-05-24,2020-05-24|2020-05-25,2020-05-25|2020-05-26,2020-05-26|2020-05-27,2020-05-27|2020-05-28,2020-05-28|2020-05-29,2020-05-29|2020-05-30,2020-05-30|2020-05-31,2020-05-31|2020-06-01,2020-06-01|2020-06-02,2020-06-02|2020-06-03,2020-06-03|2020-06-04,2020-06-04|2020-06-05,2020-06-05|2020-06-06,2020-06-06|2020-06-07,2020-06-07|2020-06-08,2020-06-08|2020-06-09,2020-06-09|2020-06-10,2020-06-10|2020-06-11,2020-06-11|2020-06-12,2020-06-12|2020-06-13,2020-06-13|2020-06-14,2020-06-14',
- 'count' => '42',
+ 'dates' => '2020-04-30,2020-04-30|2020-05-01,2020-05-01|2020-05-02,2020-05-02|2020-05-03,2020-05-03|2020-05-04,2020-05-04|2020-05-05,2020-05-05|2020-05-06,2020-05-06|2020-05-07,2020-05-07|2020-05-08,2020-05-08|2020-05-09,2020-05-09|2020-05-10,2020-05-10|2020-05-11,2020-05-11|2020-05-12,2020-05-12|2020-05-13,2020-05-13|2020-05-14,2020-05-14|2020-05-15,2020-05-15|2020-05-16,2020-05-16|2020-05-17,2020-05-17|2020-05-18,2020-05-18|2020-05-19,2020-05-19|2020-05-20,2020-05-20|2020-05-21,2020-05-21|2020-05-22,2020-05-22|2020-05-23,2020-05-23|2020-05-24,2020-05-24|2020-05-25,2020-05-25|2020-05-26,2020-05-26|2020-05-27,2020-05-27|2020-05-28,2020-05-28|2020-05-29,2020-05-29|2020-05-30,2020-05-30|2020-05-31,2020-05-31|2020-06-01,2020-06-01|2020-06-02,2020-06-02|2020-06-03,2020-06-03|2020-06-04,2020-06-04|2020-06-05,2020-06-05|2020-06-06,2020-06-06|2020-06-07,2020-06-07|2020-06-08,2020-06-08|2020-06-09,2020-06-09|2020-06-10,2020-06-10|2020-06-11,2020-06-11|2020-06-12,2020-06-12|2020-06-13,2020-06-13|2020-06-14,2020-06-14',
+ 'count' => '46',
),
array (
'idsite' => '11',
@@ -1667,8 +1667,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
'period' => '2',
'name' => 'done5f4f9bafeda3443c3c2d4b2ef4dffadc.VisitsSummary',
'report' => 'some.Report',
- 'dates' => '2020-05-04,2020-05-10|2020-05-11,2020-05-17|2020-05-18,2020-05-24|2020-05-25,2020-05-31|2020-06-01,2020-06-07|2020-06-08,2020-06-14',
- 'count' => '6',
+ 'dates' => '2020-04-27,2020-05-03|2020-05-04,2020-05-10|2020-05-11,2020-05-17|2020-05-18,2020-05-24|2020-05-25,2020-05-31|2020-06-01,2020-06-07|2020-06-08,2020-06-14',
+ 'count' => '7',
),
array (
'idsite' => '11',
@@ -1683,8 +1683,8 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
'period' => '3',
'name' => 'done5f4f9bafeda3443c3c2d4b2ef4dffadc.VisitsSummary',
'report' => 'some.Report',
- 'dates' => '2020-05-01,2020-05-31|2020-06-01,2020-06-30',
- 'count' => '2',
+ 'dates' => '2020-04-01,2020-04-30|2020-05-01,2020-05-31|2020-06-01,2020-06-30',
+ 'count' => '3',
),
array (
'idsite' => '11',
diff --git a/tests/PHPUnit/Integration/PluginTest.php b/tests/PHPUnit/Integration/PluginTest.php
index 756749ee01..7ab46a8945 100644
--- a/tests/PHPUnit/Integration/PluginTest.php
+++ b/tests/PHPUnit/Integration/PluginTest.php
@@ -84,11 +84,11 @@ class PluginTest extends IntegrationTestCase
$item = reset($items);
$item = json_decode($item, $assocc = true);
- $date = end($item);
- if (empty($date)) {
- return $date;
+ if (empty($item['startDate'])) {
+ return null;
}
+ $date = $item['startDate'];
return Date::factory($date)->getDatetime();
}
diff --git a/tests/PHPUnit/System/ArchiveInvalidationTest.php b/tests/PHPUnit/System/ArchiveInvalidationTest.php
index bb1e9e6083..95d756c2ce 100644
--- a/tests/PHPUnit/System/ArchiveInvalidationTest.php
+++ b/tests/PHPUnit/System/ArchiveInvalidationTest.php
@@ -52,7 +52,7 @@ class ArchiveInvalidationTest extends SystemTestCase
return array(
array($apiToCall, array('idSite' => self::$fixture->idSite2,
- 'testSuffix' => 'Website' . self::$fixture->idSite2 . "_NewDataShouldNotAppear_BecauseDayWasNotInvalidated",
+ 'testSuffix' => 'Website' . self::$fixture->idSite2 . $this->suffix,
'date' => self::$fixture->dateTimeFirstDateWebsite2,
'periods' => 'day',
'segment' => 'pageUrl=@category/',
@@ -135,7 +135,8 @@ class ArchiveInvalidationTest extends SystemTestCase
$r = new Request("module=API&method=CoreAdminHome.invalidateArchivedReports&idSites=" . self::$fixture->idSite1 . "&dates=" . $dateToInvalidate1->format('Y-m-d'));
$this->assertApiResponseHasNoError($r->process());
- // week reports only are invalidated and we test our daily report will still show old data.
+ // week reports only are invalidated. we test our daily report will show new data, even though weekly reports only are invalidated,
+ // because when we track data, it invalidates day periods as well.
$this->invalidateTestArchive(self::$fixture->idSite2, 'week', self::$fixture->dateTimeFirstDateWebsite2);
}
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__Actions.getPageUrls_day.xml
new file mode 100644
index 0000000000..e91a63b485
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__Actions.getPageUrls_day.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2010-01-06">
+ <row>
+ <label>category</label>
+ <nb_visits>6</nb_visits>
+ <nb_hits>9</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <entry_nb_visits>2</entry_nb_visits>
+ <entry_nb_actions>18</entry_nb_actions>
+ <entry_sum_visit_length>2</entry_sum_visit_length>
+ <entry_bounce_count>0</entry_bounce_count>
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252Fcategory</segment>
+ <subtable>
+ <row>
+ <label>/Page1</label>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <entry_nb_uniq_visitors>2</entry_nb_uniq_visitors>
+ <entry_nb_visits>2</entry_nb_visits>
+ <entry_nb_actions>18</entry_nb_actions>
+ <entry_sum_visit_length>2</entry_sum_visit_length>
+ <entry_bounce_count>0</entry_bounce_count>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page1</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage1</segment>
+ </row>
+ <row>
+ <label>/Page2</label>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page2</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage2</segment>
+ </row>
+ <row>
+ <label>/NewPage</label>
+ <nb_visits>1</nb_visits>
+ <nb_uniq_visitors>2</nb_uniq_visitors>
+ <nb_hits>2</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/NewPage</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FNewPage</segment>
+ </row>
+ <row>
+ <label>/Page3</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page3</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage3</segment>
+ </row>
+ </subtable>
+ </row>
+ <row>
+ <label>/Contact</label>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/Contact</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FContact</segment>
+ </row>
+ <row>
+ <label>/Home</label>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/Home</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FHome</segment>
+ </row>
+ <row>
+ <label>Contact</label>
+ <nb_visits>2</nb_visits>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <exit_nb_visits>2</exit_nb_visits>
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>100%</exit_rate>
+ <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252FContact</segment>
+ <subtable>
+ <row>
+ <label>/ThankYou</label>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <exit_nb_uniq_visitors>2</exit_nb_uniq_visitors>
+ <exit_nb_visits>2</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/Contact/ThankYou</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FContact%252FThankYou</segment>
+ </row>
+ </subtable>
+ </row>
+ </result>
+ <result date="2010-01-07" />
+ <result date="2010-01-08" />
+ <result date="2010-01-09" />
+ <result date="2010-01-10" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__VisitsSummary.get_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__VisitsSummary.get_day.xml
new file mode 100644
index 0000000000..bfd375c5c9
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldAppear__VisitsSummary.get_day.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2010-01-06">
+ <nb_uniq_visitors>2</nb_uniq_visitors>
+ <nb_users>0</nb_users>
+ <nb_visits>2</nb_visits>
+ <nb_actions>18</nb_actions>
+ <nb_visits_converted>0</nb_visits_converted>
+ <bounce_count>0</bounce_count>
+ <sum_visit_length>2</sum_visit_length>
+ <max_actions>12</max_actions>
+ <bounce_rate>0%</bounce_rate>
+ <nb_actions_per_visit>9</nb_actions_per_visit>
+ <avg_time_on_site>1</avg_time_on_site>
+ </result>
+ <result date="2010-01-07" />
+ <result date="2010-01-08" />
+ <result date="2010-01-09" />
+ <result date="2010-01-10" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__Actions.getPageUrls_day.xml
index b3a70db9d0..e91a63b485 100644
--- a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__Actions.getPageUrls_day.xml
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__Actions.getPageUrls_day.xml
@@ -3,16 +3,16 @@
<result date="2010-01-06">
<row>
<label>category</label>
- <nb_visits>3</nb_visits>
- <nb_hits>3</nb_hits>
+ <nb_visits>6</nb_visits>
+ <nb_hits>9</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth />
<max_bandwidth />
- <entry_nb_visits>1</entry_nb_visits>
- <entry_nb_actions>6</entry_nb_actions>
- <entry_sum_visit_length>1</entry_sum_visit_length>
+ <entry_nb_visits>2</entry_nb_visits>
+ <entry_nb_actions>18</entry_nb_actions>
+ <entry_sum_visit_length>2</entry_sum_visit_length>
<entry_bounce_count>0</entry_bounce_count>
<avg_bandwidth>0</avg_bandwidth>
<avg_page_load_time>0</avg_page_load_time>
@@ -23,18 +23,18 @@
<subtable>
<row>
<label>/Page1</label>
- <nb_visits>1</nb_visits>
- <nb_uniq_visitors>1</nb_uniq_visitors>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth />
<max_bandwidth />
- <entry_nb_uniq_visitors>1</entry_nb_uniq_visitors>
- <entry_nb_visits>1</entry_nb_visits>
- <entry_nb_actions>6</entry_nb_actions>
- <entry_sum_visit_length>1</entry_sum_visit_length>
+ <entry_nb_uniq_visitors>2</entry_nb_uniq_visitors>
+ <entry_nb_visits>2</entry_nb_visits>
+ <entry_nb_actions>18</entry_nb_actions>
+ <entry_sum_visit_length>2</entry_sum_visit_length>
<entry_bounce_count>0</entry_bounce_count>
<avg_time_on_page>0</avg_time_on_page>
<bounce_rate>0%</bounce_rate>
@@ -44,9 +44,9 @@
</row>
<row>
<label>/Page2</label>
- <nb_visits>1</nb_visits>
- <nb_uniq_visitors>1</nb_uniq_visitors>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
@@ -59,6 +59,22 @@
<segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage2</segment>
</row>
<row>
+ <label>/NewPage</label>
+ <nb_visits>1</nb_visits>
+ <nb_uniq_visitors>2</nb_uniq_visitors>
+ <nb_hits>2</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/NewPage</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FNewPage</segment>
+ </row>
+ <row>
<label>/Page3</label>
<nb_visits>1</nb_visits>
<nb_uniq_visitors>1</nb_uniq_visitors>
@@ -78,9 +94,9 @@
</row>
<row>
<label>/Contact</label>
- <nb_visits>1</nb_visits>
- <nb_uniq_visitors>1</nb_uniq_visitors>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
@@ -96,9 +112,9 @@
</row>
<row>
<label>/Home</label>
- <nb_visits>1</nb_visits>
- <nb_uniq_visitors>1</nb_uniq_visitors>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
@@ -114,14 +130,14 @@
</row>
<row>
<label>Contact</label>
- <nb_visits>1</nb_visits>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth />
<max_bandwidth />
- <exit_nb_visits>1</exit_nb_visits>
+ <exit_nb_visits>2</exit_nb_visits>
<avg_bandwidth>0</avg_bandwidth>
<avg_page_load_time>0</avg_page_load_time>
<avg_time_on_page>0</avg_time_on_page>
@@ -131,16 +147,16 @@
<subtable>
<row>
<label>/ThankYou</label>
- <nb_visits>1</nb_visits>
- <nb_uniq_visitors>1</nb_uniq_visitors>
- <nb_hits>1</nb_hits>
+ <nb_visits>2</nb_visits>
+ <nb_uniq_visitors>3</nb_uniq_visitors>
+ <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent>
<sum_bandwidth>0</sum_bandwidth>
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth />
<max_bandwidth />
- <exit_nb_uniq_visitors>1</exit_nb_uniq_visitors>
- <exit_nb_visits>1</exit_nb_visits>
+ <exit_nb_uniq_visitors>2</exit_nb_uniq_visitors>
+ <exit_nb_visits>2</exit_nb_visits>
<avg_time_on_page>0</avg_time_on_page>
<bounce_rate>0%</bounce_rate>
<exit_rate>100%</exit_rate>
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__VisitsSummary.get_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__VisitsSummary.get_day.xml
index 241f0a7a02..bfd375c5c9 100644
--- a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__VisitsSummary.get_day.xml
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear_BecauseDayWasNotInvalidated__VisitsSummary.get_day.xml
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result date="2010-01-06">
- <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_uniq_visitors>2</nb_uniq_visitors>
<nb_users>0</nb_users>
- <nb_visits>1</nb_visits>
- <nb_actions>6</nb_actions>
+ <nb_visits>2</nb_visits>
+ <nb_actions>18</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>0</bounce_count>
- <sum_visit_length>1</sum_visit_length>
- <max_actions>6</max_actions>
+ <sum_visit_length>2</sum_visit_length>
+ <max_actions>12</max_actions>
<bounce_rate>0%</bounce_rate>
- <nb_actions_per_visit>6</nb_actions_per_visit>
+ <nb_actions_per_visit>9</nb_actions_per_visit>
<avg_time_on_site>1</avg_time_on_site>
</result>
<result date="2010-01-07" />
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__Actions.getPageUrls_day.xml
new file mode 100644
index 0000000000..b3a70db9d0
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__Actions.getPageUrls_day.xml
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2010-01-06">
+ <row>
+ <label>category</label>
+ <nb_visits>3</nb_visits>
+ <nb_hits>3</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <entry_nb_visits>1</entry_nb_visits>
+ <entry_nb_actions>6</entry_nb_actions>
+ <entry_sum_visit_length>1</entry_sum_visit_length>
+ <entry_bounce_count>0</entry_bounce_count>
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252Fcategory</segment>
+ <subtable>
+ <row>
+ <label>/Page1</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <entry_nb_uniq_visitors>1</entry_nb_uniq_visitors>
+ <entry_nb_visits>1</entry_nb_visits>
+ <entry_nb_actions>6</entry_nb_actions>
+ <entry_sum_visit_length>1</entry_sum_visit_length>
+ <entry_bounce_count>0</entry_bounce_count>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page1</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage1</segment>
+ </row>
+ <row>
+ <label>/Page2</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page2</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage2</segment>
+ </row>
+ <row>
+ <label>/Page3</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/category/Page3</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252Fcategory%252FPage3</segment>
+ </row>
+ </subtable>
+ </row>
+ <row>
+ <label>/Contact</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/Contact</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FContact</segment>
+ </row>
+ <row>
+ <label>/Home</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>0%</exit_rate>
+ <url>http://example.org/Home</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FHome</segment>
+ </row>
+ <row>
+ <label>Contact</label>
+ <nb_visits>1</nb_visits>
+ <nb_hits>1</nb_hits>
+ <sum_time_spent>0</sum_time_spent>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <exit_nb_visits>1</exit_nb_visits>
+ <avg_bandwidth>0</avg_bandwidth>
+ <avg_page_load_time>0</avg_page_load_time>
+ <avg_time_on_page>0</avg_time_on_page>
+ <bounce_rate>0%</bounce_rate>
+ <exit_rate>100%</exit_rate>
+ <segment>pageUrl=^http%253A%252F%252Fpiwik.net%252FContact</segment>
+ <subtable>
+ <row>
+ <label>/ThankYou</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>
+ <sum_bandwidth>0</sum_bandwidth>
+ <nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
+ <min_bandwidth />
+ <max_bandwidth />
+ <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/Contact/ThankYou</url>
+ <segment>pageUrl==http%253A%252F%252Fexample.org%252FContact%252FThankYou</segment>
+ </row>
+ </subtable>
+ </row>
+ </result>
+ <result date="2010-01-07" />
+ <result date="2010-01-08" />
+ <result date="2010-01-09" />
+ <result date="2010-01-10" />
+</results> \ No newline at end of file
diff --git a/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__VisitsSummary.get_day.xml b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__VisitsSummary.get_day.xml
new file mode 100644
index 0000000000..241f0a7a02
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_Archive_InvalidationWebsite2_NewDataShouldNotAppear__VisitsSummary.get_day.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result date="2010-01-06">
+ <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_users>0</nb_users>
+ <nb_visits>1</nb_visits>
+ <nb_actions>6</nb_actions>
+ <nb_visits_converted>0</nb_visits_converted>
+ <bounce_count>0</bounce_count>
+ <sum_visit_length>1</sum_visit_length>
+ <max_actions>6</max_actions>
+ <bounce_rate>0%</bounce_rate>
+ <nb_actions_per_visit>6</nb_actions_per_visit>
+ <avg_time_on_site>1</avg_time_on_site>
+ </result>
+ <result date="2010-01-07" />
+ <result date="2010-01-08" />
+ <result date="2010-01-09" />
+ <result date="2010-01-10" />
+</results> \ No newline at end of file