public static function setUpBeforeClass() { parent::setUpBeforeClass(); try { self::$dateTime = Piwik_Date::factory('now')->getDateTime(); self::setUpWebsitesAndGoals(); self::trackVisits(); } catch (Exception $e) { // Skip whole test suite if an error occurs while setup throw new PHPUnit_Framework_SkippedTestSuiteError($e->getMessage()); } }
} /** * @dataProvider getApiForTesting * @group Integration */ public function testApi($api, $params) { $this->runApiTests($api, $params); } public function getApiForTesting() { $idSite = self::$fixture->idSite; $visitorId = self::$fixture->visitorId; $apiToCall = array('API.getProcessedReport', 'Actions.getPageUrls', 'Goals.get', 'CustomVariables.getCustomVariables', 'Referrers.getCampaigns', 'Referrers.getKeywords', 'VisitsSummary.get', 'Live'); $segments = array(false, 'daysSinceFirstVisit!=50', 'visitorId!=33c31e01394bdc63', 'visitorId!=33c31e01394bdc63;daysSinceFirstVisit!=50', 'pageUrl!=http://unknown/not/viewed'); $dates = array('last7', Date::factory('now')->subDay(6)->toString() . ',today', Date::factory('now')->subDay(6)->toString() . ',now'); $result = array(); foreach ($segments as $segment) { foreach ($dates as $date) { $result[] = array($apiToCall, array('idSite' => $idSite, 'date' => $date, 'periods' => array('range'), 'segment' => $segment, 'visitorId' => $visitorId, 'otherRequestParameters' => array('lastMinutes' => 60 * 24))); } } return $result; } public static function getOutputPrefix() { return 'periodIsRange_dateIsLastN_MetadataAndNormalAPI'; } } Test_Piwik_Integration_PeriodIsRange_DateIsLastN_MetadataAndNormalAPI::$fixture = new Test_Piwik_Fixture_TwoVisitsWithCustomVariables(); Test_Piwik_Integration_PeriodIsRange_DateIsLastN_MetadataAndNormalAPI::$fixture->doExtraQuoteTests = false;