public static function setUpBeforeClass() { parent::setUpBeforeClass(); // note: not sure why I have to manually install plugin \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomAlerts')->install(); $result = Fixture::updateDatabase(); if ($result === false) { throw new \Exception("Failed to update pre-2.0 database (nothing to update)."); } // 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'); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); // note: not sure why I have to manually install plugin \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomAlerts')->install(); $result = Fixture::updateDatabase(); if ($result === false) { throw new \Exception("Failed to update pre-2.0 database (nothing to update)."); } // 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)); } self::trackTwoVisitsOnSameDay(); // launch archiving VisitFrequencyApi::getInstance()->get(1, 'year', '2012-12-29'); }
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'); }