*/
public function endPostProcess(&$rows = NULL) {
$this->assign('report_class', get_class($this));
+
+ // This is used by unit tests, where _outputMode is intentionally blank.
+ // Is there a reason it couldn't just always do this? It effectively does
+ // the same thing anyway by assigning it to the template (in
+ // doTemplateAssignment()).
if ($this->_storeResultSet) {
$this->_resultSet = $rows;
}
/**
* Set store result set indicator to TRUE.
*
- * @todo explain what this does
+ * This is used by unit tests, along with getResultSet(), to get just
+ * the output rows unformatted.
*/
public function storeResultSet() {
$this->_storeResultSet = TRUE;
public function getReportOutputAsCsv($reportClass, $inputParams) {
$reportObj = $this->getReportObject($reportClass, $inputParams);
- try {
- $rows = $reportObj->getResultSet();
- $tmpFile = $this->createTempDir() . CRM_Utils_File::makeFileName('CiviReport.csv');
- $csvContent = CRM_Report_Utils_Report::makeCsv($reportObj, $rows);
- file_put_contents($tmpFile, $csvContent);
- }
- catch (Exception $e) {
- throw $e;
- }
+ $rows = $reportObj->getResultSet();
+ $tmpFile = $this->createTempDir() . CRM_Utils_File::makeFileName('CiviReport.csv');
+ $csvContent = CRM_Report_Utils_Report::makeCsv($reportObj, $rows);
+ file_put_contents($tmpFile, $csvContent);
return $tmpFile;
}