setColumn('sum_event_value', '2'); $value->setColumn('max_event_value', '2'); $value->setColumn('min_event_value', '2'); $value->setColumn('sum_daily_nb_uniq_visitors', '2'); $value->setColumn('avg_event_value', '2'); if ($value->isSubtableLoaded()) { $subtable = $value->getSubtable(); foreach ($subtable->getRows() as $row) { $row->setColumn('sum_event_value', '2'); $row->setColumn('max_event_value', '2'); $row->setColumn('min_event_value', '2'); $row->setColumn('sum_daily_nb_uniq_visitors', '2'); $row->setColumn('avg_event_value', '2'); } } } }); } /** * @dataProvider getApiForTesting */ public function testApi($api, $params) { $this->runApiTests($api, $params); } public function getApiForTesting() { $apis = [ 'API.get', 'Actions.getPageUrls', 'Actions.getPageTitles', 'Events', 'Referrers.getReferrerType', 'CustomVariables', ]; $xmlFieldsToRemove = []; if (version_compare(Version::VERSION, '5.5.0-b1', '<')) { $xmlFieldsToRemove = ['Referrers_visitorsFromAIAssistants', 'Referrers_distinctAIAssistants', 'Referrers_visitorsFromAIAssistants_percent']; } if (version_compare(Version::VERSION, '5.6.0-alpha', '<')) { // In Matomo 5.6 AI agent information had been added $xmlFieldsToRemove = array_merge($xmlFieldsToRemove, [ 'nb_visits_ai_agent', 'nb_actions_ai_agent', 'nb_uniq_visitors_ai_agent', 'nb_users_ai_agent', 'max_actions_ai_agent', 'bounce_rate_ai_agent', 'nb_actions_per_visit_ai_agent', 'avg_time_on_site_ai_agent', 'nb_visits_human', 'nb_actions_human', 'nb_uniq_visitors_human', 'nb_users_human', 'max_actions_human', 'bounce_rate_human', 'nb_actions_per_visit_human', 'avg_time_on_site_human', ]); } if (version_compare(Version::VERSION, '5.7.0-b1', '<')) { $xmlFieldsToRemove = array_merge($xmlFieldsToRemove, [ 'BotTracking_AIChatbotsRequests', 'BotTracking_AIChatbotsAcquiredVisits', 'BotTracking_AIChatbotsNotFoundRequests', 'BotTracking_AIChatbotsUniqueChatbots', 'BotTracking_AIChatbotsServerErrorRequests', 'BotTracking_AIChatbotsClickThroughRate', ]); } $apiToTest = []; foreach ($apis as $api) { $apiToTest[] = [ $api, [ 'idSite' => 1, 'date' => 'today', 'periods' => ['year'], 'otherRequestParameters' => [ 'hideColumns' => 'hits,sum_visit_length,entry_sum_visit_length,avg_time_on_site_new,sum_bandwidth,nb_hits_with_bandwidth,min_bandwidth,max_bandwidth,avg_bandwidth,nb_total_overall_bandwidth,nb_total_pageview_bandwidth,nb_total_download_bandwidth', ], // when calling CustomVariables.getUsagesOfSlots, new archives are created until 'today', // which increments idsubdatatable, but we need to have deterministic idsubdatatable 'apiNotToCall' => ['CustomVariables.getUsagesOfSlots'], 'xmlFieldsToRemove' => $xmlFieldsToRemove, ] ]; } return $apiToTest; } public static function getOutputPrefix() { return ''; } public static function getPathToTestDirectory() { return dirname(__FILE__); } } TasksTest::$fixture = new SendSystemReportTaskFixture();