setUpWebsitesAndGoals(); self::downloadGeoIpDbs(); $this->setMockLocationProvider(); $this->trackVisits(9, false); $this->setLocationProvider('GeoIPCity.dat'); $this->trackVisits(2, true, $useLocal = false); $this->trackVisits(4, true, $useLocal = false, $doBulk = true); $this->setLocationProvider('GeoIP.dat'); $this->trackVisits(2, true); $this->trackOtherVisits(); $this->setLocationProvider('GeoIPCity.dat'); } public function tearDown() { $this->unsetLocationProvider(); } private function setUpWebsitesAndGoals() { self::createWebsite($this->dateTime, 0, "Site 1"); $this->idGoal = Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5); $this->idGoal2 = Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'two', 'url', 'xxxxxxxxxxxxx', 'contains', false, 5); } private function trackVisits($visitorCount, $setIp = false, $useLocal = true, $doBulk = false) { static $calledCounter = 0; $calledCounter++; $dateTime = $this->dateTime; $idSite = $this->idSite; // use local tracker so mock location provider can be used $t = self::getTracker($idSite, $dateTime, $defaultInit = true, $useLocal); if ($doBulk) { $t->enableBulkTracking(); $t->setTokenAuth(self::getTokenAuth()); } for ($i = 0; $i != $visitorCount; ++$i) { $t->setVisitorId( substr(md5($i + $calledCounter * 1000), 0, $t::LENGTH_VISITOR_ID)); if ($setIp) { $t->setIp(current($this->ips)); next($this->ips); } else { $t->setIp("1.2.4.$i"); } // first visit $date = Piwik_Date::factory($dateTime)->addDay($i); $t->setForceVisitDateTime($date->getDatetime()); $t->setUrl("http://piwik.net/grue/lair"); $t->setCustomVariable(1, 'Cvar 1 name', 'Cvar1 value is ' .$i , 'visit'); $t->setCustomVariable(5, 'Cvar 5 name', 'Cvar5 value is ' .$i , 'visit'); $t->setCustomVariable(2, 'Cvar 2 PAGE name', 'Cvar2 PAGE value is ' .$i, 'page'); $t->setCustomVariable(5, 'Cvar 5 PAGE name', 'Cvar5 PAGE value is ' .$i, 'page'); $r = $t->doTrackPageView('It\'s