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
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2019-07-12 03:37:58 +0300
committerGitHub <noreply@github.com>2019-07-12 03:37:58 +0300
commit2eaa4034a79ae0b08f8444c0d867e9ba17b93517 (patch)
treecad66abc5820ae3a298668f0525a82abc1b43406 /tests/PHPUnit/Integration
parentce9b7cb69e349489e74527749c47e080fed27128 (diff)
If new visit is forced, known visitors should still be recognized (#14491)
* Enforcing a new visit should not result in the visitor becoming unrecognized. * Adding test for bug. * update expected test files * Fix integration test. * Update submodule * Update test files.
Diffstat (limited to 'tests/PHPUnit/Integration')
-rw-r--r--tests/PHPUnit/Integration/TrackerTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/TrackerTest.php b/tests/PHPUnit/Integration/TrackerTest.php
index 8b2775e1a8..fb160679ce 100644
--- a/tests/PHPUnit/Integration/TrackerTest.php
+++ b/tests/PHPUnit/Integration/TrackerTest.php
@@ -11,6 +11,7 @@ namespace Piwik\Tests\Integration;
use Piwik\Common;
use Piwik\Config;
use Piwik\Date;
+use Piwik\Db;
use Piwik\Option;
use Piwik\Piwik;
use Piwik\SettingsServer;
@@ -389,6 +390,25 @@ class TrackerTest extends IntegrationTestCase
$this->assertEmpty(Option::getLike('report_to_invalidate_2_2019-04-02%'));
}
+ public function test_TrackingNewVisitOfKnownVisitor()
+ {
+ Fixture::createWebsite('2015-01-01 00:00:00');
+
+ // track one visit
+ $t = self::$fixture->getTracker($idSite = 1, '2015-01-01', $defaultInit = true, $useLocalTracker = true);
+ $t->setForceVisitDateTime('2015-08-06 07:53:09');
+ $t->setNewVisitorId();
+ Fixture::checkResponse($t->doTrackPageView('page view'));
+
+ // track action 2 seconds later w/ new_visit=1
+ $t->setForceVisitDateTime('2015-08-06 07:53:11');
+ $t->setCustomTrackingParameter('new_visit', '1');
+ Fixture::checkResponse($t->doTrackPageView('page view 2'));
+
+ $this->assertEquals(2, $this->getVisitCount());
+ $this->assertEquals(1, $this->getReturningVisitorCount());
+ }
+
private function getDefaultHandler()
{
return new Tracker\Handler();
@@ -448,6 +468,23 @@ class TrackerTest extends IntegrationTestCase
rename($this->getLocalConfigPathMoved(), $this->getLocalConfigPath());
}
}
+
+ private function getVisitCount()
+ {
+ return Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('log_visit'));
+ }
+
+ private function getReturningVisitorCount()
+ {
+ return Db::fetchOne("SELECT COUNT(DISTINCT idvisitor) FROM " . Common::prefixTable('log_visit') . ' WHERE visitor_returning = 1');
+ }
+
+ protected static function configureFixture($fixture)
+ {
+ parent::configureFixture($fixture);
+
+ $fixture->createSuperUser = true;
+ }
}
class TestTracker extends Tracker