public function testUpdateWorksAfterPiwikIsAlreadyUpToDate() { $result = Fixture::updateDatabase($force = true); if ($result === false) { throw new \Exception("Failed to force update (nothing to update)."); } }
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'); }