setUpWebsitesAndGoals(); $this->simulateIntegerOverflow(); $this->trackVisits(); } public function tearDown() { // empty } private function simulateIntegerOverflow() { if(!$this->simulateIntegerOverflow) { return; } $overflow = $this->maxUnsignedIntegerValue; // overflow in log_visit $table = Common::prefixTable('log_visit'); Db::query("INSERT INTO $table (idvisit) VALUES ($overflow)"); // overflow in log_link_visit_action $table = Common::prefixTable('log_link_visit_action'); Db::query("INSERT INTO $table (idlink_va) VALUES ($overflow)"); } private function setUpWebsitesAndGoals() { if (!self::siteCreated($idSite = 1)) { self::createWebsite($this->dateTime); } if (!self::siteCreated($idSite = 2)) { $this->idSiteEmptyBis = $this->createWebsite($this->dateTime); } if (!self::siteCreated($idSite = 3)) { $this->idSiteEmptyTer = $this->createWebsite($this->dateTime); } } private function trackVisits() { $dateTime = $this->dateTime; $idSite = $this->idSite; if ($this->excludeMozilla) { APISitesManager::getInstance()->setSiteSpecificUserAgentExcludeEnabled(false); } self::createSuperUser(); $t = self::getTracker($idSite, $dateTime, $defaultInit = true); Cache::clearCacheGeneral(); Cache::regenerateCacheWebsiteAttributes(array($idSite)); if ($this->useThirdPartyCookies) { $t->DEBUG_APPEND_URL = '&forceUseThirdPartyCookie=1'; } $t->disableCookieSupport(); $t->setUrlReferrer('http://referrer.com/page.htm?param=valuewith some spaces'); // testing URL excluded parameters $parameterToExclude = 'excluded_parameter'; APISitesManager::getInstance()->updateSite( $idSite, 'new name', $url = array('http://site.com'), $ecommerce = 0, $siteSearch = $this->useSiteSearch ? 1 : 0, $searchKeywordParameters = $this->useSiteSearch ? '' : null, $searchCategoryParameters = $this->useSiteSearch ? 'notparam' : null, $excludedIps = null, $parameterToExclude . ',anotherParameter', $timezone = null, $currency = null, $group = null, $startDate = null, // test that visit won't be excluded since site-specific exclude is not enabled $excludedUserAgents = $this->excludeMozilla ? 'mozilla' : null ); // Record 1st page view $urlPage1 = 'http://example.org/index.htm?excluded_Parameter=SHOULD_NOT_DISPLAY¶meter=Should display'; $t->setUrl($urlPage1); $t->setGenerationTime(234); self::checkResponse($t->doTrackPageView('incredible title!')); // testing that / and index.htm above record with different URLs // Recording the 2nd page after 3 minutes $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.05)->getDatetime()); $t->setUrl('http://example.org/'); $t->setGenerationTime(224); self::checkResponse($t->doTrackPageView('Second page view - should be registered as URL /')); // Click on external link after 6 minutes (3rd action) $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1)->getDatetime()); // Testing Outlink that contains a URL Fragment self::checkResponse($t->doTrackAction('https://outlinks.org/#!outlink-with-fragment-