diff --git a/grade/export/xml/grade_export_xml.php b/grade/export/xml/grade_export_xml.php index aad24e49968..de1b97989d5 100644 --- a/grade/export/xml/grade_export_xml.php +++ b/grade/export/xml/grade_export_xml.php @@ -101,8 +101,13 @@ class grade_export_xml extends grade_export { $gui->close(); $geub->close(); - @header("Content-type: text/xml; charset=UTF-8"); - send_temp_file($tempfilename, $downloadfilename, false); + if (defined('BEHAT_SITE_RUNNING')) { + // If behat is running, we cannot test the output if we force a file download. + include($tempfilename); + } else { + @header("Content-type: text/xml; charset=UTF-8"); + send_temp_file($tempfilename, $downloadfilename, false); + } } } diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index b03f48a5320..c3e4d9df711 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -471,6 +471,11 @@ class csv_export_writer { */ protected function send_header() { global $CFG; + + if (defined('BEHAT_SITE_RUNNING')) { + // For text based formats - we cannot test the output with behat if we force a file download. + return; + } if (strpos($CFG->wwwroot, 'https://') === 0) { //https sites - watch out for IE! KB812935 and KB316431 header('Cache-Control: max-age=10'); header('Pragma: ');