Skip to content
Snippets Groups Projects
Commit 83d1d6f5 authored by Tim Hunt's avatar Tim Hunt
Browse files

Unlock the session before running question tests

Hence, exectue the tests after output has started.
parent cc1375cf
Branches
Tags
No related merge requests found
...@@ -103,16 +103,6 @@ flush(); ...@@ -103,16 +103,6 @@ flush();
// Load the list of test cases. // Load the list of test cases.
$testscases = question_bank::get_qtype('stack')->load_question_tests($question->id); $testscases = question_bank::get_qtype('stack')->load_question_tests($question->id);
// Execute the tests.
$testresults = array();
$allpassed = true;
foreach ($testscases as $key => $testcase) {
$testresults[$key] = $testcase->test_question($quba, $question, $seed);
if (!$testresults[$key]->passed()) {
$allpassed = false;
}
}
$deployfeedback = optional_param('deployfeedback', null, PARAM_TEXT); $deployfeedback = optional_param('deployfeedback', null, PARAM_TEXT);
if (!is_null($deployfeedback)) { if (!is_null($deployfeedback)) {
echo html_writer::tag('p', $deployfeedback, array('class' => 'overallresult pass')); echo html_writer::tag('p', $deployfeedback, array('class' => 'overallresult pass'));
...@@ -277,6 +267,18 @@ if (!(empty($question->deployedseeds)) && $canedit) { ...@@ -277,6 +267,18 @@ if (!(empty($question->deployedseeds)) && $canedit) {
// Display the controls to add another question test. // Display the controls to add another question test.
echo $OUTPUT->heading(stack_string('questiontests'), 2); echo $OUTPUT->heading(stack_string('questiontests'), 2);
\core\session\manager::write_close();
// Execute the tests.
$testresults = array();
$allpassed = true;
foreach ($testscases as $key => $testcase) {
$testresults[$key] = $testcase->test_question($quba, $question, $seed);
if (!$testresults[$key]->passed()) {
$allpassed = false;
}
}
// Display the test results. // Display the test results.
$addlabel = stack_string('addanothertestcase', 'qtype_stack'); $addlabel = stack_string('addanothertestcase', 'qtype_stack');
if (empty($testresults)) { if (empty($testresults)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment