Esempio n. 1
0
 /**
  * Return 4 Api Urls for testing scheduled reports :
  * - one in HTML format with all available reports
  * - one in PDF format with all available reports
  * - two in SMS (one for each available report: MultiSites.getOne & MultiSites.getAll)
  *
  * @param string $dateTime eg '2010-01-01 12:34:56'
  * @param string $period eg 'day', 'week', 'month', 'year'
  * @return array
  */
 protected static function getApiForTestingScheduledReports($dateTime, $period)
 {
     $apiCalls = array();
     // HTML Scheduled Report
     array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_in_html_tables_only', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'html', 'otherRequestParameters' => array('idReport' => 1, 'reportFormat' => ReportRenderer::HTML_FORMAT, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     // CSV Scheduled Report
     array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_in_csv', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'csv', 'otherRequestParameters' => array('idReport' => 1, 'reportFormat' => ReportRenderer::CSV_FORMAT, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     if (Fixture::canImagesBeIncludedInScheduledReports()) {
         // PDF Scheduled Report
         // tests/PHPUnit/Integration/processed/test_ecommerceOrderWithItems_scheduled_report_in_pdf_tables_only__ScheduledReports.generateReport_week.original.pdf
         array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_in_pdf_tables_only', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'pdf', 'otherRequestParameters' => array('idReport' => 1, 'reportFormat' => ReportRenderer::PDF_FORMAT, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     }
     // SMS Scheduled Report, one site
     array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_via_sms_one_site', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'sms.txt', 'otherRequestParameters' => array('idReport' => 2, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     // SMS Scheduled Report, all sites
     array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_via_sms_all_sites', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'sms.txt', 'otherRequestParameters' => array('idReport' => 3, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     if (Fixture::canImagesBeIncludedInScheduledReports()) {
         // HTML Scheduled Report with images
         array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_in_html_tables_and_graph', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'html', 'otherRequestParameters' => array('idReport' => 4, 'reportFormat' => ReportRenderer::HTML_FORMAT, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
         // mail report with one row evolution based png graph
         array_push($apiCalls, array('ScheduledReports.generateReport', array('testSuffix' => '_scheduled_report_in_html_row_evolution_graph', 'date' => $dateTime, 'periods' => array($period), 'format' => 'original', 'fileExtension' => 'html', 'otherRequestParameters' => array('idReport' => 5, 'outputType' => \Piwik\Plugins\ScheduledReports\API::OUTPUT_RETURN))));
     }
     return $apiCalls;
 }