public function setUp() { // add one site Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/"); // add two goals $goals = API::getInstance(); $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5); $goals->addGoal($this->idSite, 'all', 'url', 'thing2', 'contains'); $start = Date::factory($this->date); $dates = array(); for ($day = 0; $day != 31; ++$day) { $dates[] = $start->addDay($day); } $t = BenchmarkTestCase::getLocalTracker($this->idSite); $actionNum = 0; foreach ($dates as $date) { for ($visitNum = 0; $visitNum != 1000; ++$visitNum) { if ($visitNum % 2 == 0) { $url = "http://whatever.com/{$actionNum}/0/1/2/3/4/5/6/7/8/9"; $referrerUrl = "http://google.com/?q={$actionNum}"; } else { $url = "http://whatever.com/thing2/{$actionNum}/0/1/2/3/4/5/6/7/8/9"; $referrerUrl = "http://"; } $title = "A page title / {$actionNum} / 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 /9"; $t->setNewVisitorId(); $t->setForceVisitDateTime($date); $t->setUrl($url); $t->setUrlReferrer($referrerUrl); Fixture::checkResponse($t->doTrackPageView($title)); ++$actionNum; } } }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); self::updateDatabase(); // truncate log tables so old data won't be re-archived foreach (array('log_visit', 'log_link_visit_action', 'log_conversion', 'log_conversion_item') as $table) { Db::query("TRUNCATE TABLE " . Common::prefixTable($table)); } // add two visits from same visitor on dec. 29 $t = Fixture::getTracker(1, '2012-12-29 01:01:30', $defaultInit = true); $t->setUrl('http://site.com/index.htm'); $t->setIp('136.5.3.2'); Fixture::checkResponse($t->doTrackPageView('incredible title!')); $t->setForceVisitDateTime('2012-12-29 03:01:30'); $t->setUrl('http://site.com/other/index.htm'); $t->DEBUG_APPEND_URL = '&_idvc=2'; // make sure visit is marked as returning Fixture::checkResponse($t->doTrackPageView('other incredible title!')); // launch archiving VisitFrequencyApi::getInstance()->get(1, 'year', '2012-12-29'); }