Skip to content
Snippets Groups Projects
Commit 27a756bf authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Bulk test all versions of questions.

parent 6f5b8e7c
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ require_once(__DIR__.'/../../../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/locallib.php');
require_once(__DIR__ . '/stack/questiontest.php');
require_once(__DIR__ . '/stack/bulktester.class.php');
// Get the parameters from the URL.
......@@ -167,6 +168,10 @@ if (!$question->has_random_variants()) {
new pix_icon('t/delete', stack_string('undeploy')));
}
// Bulk test all versions.
$bulktester = new stack_bulk_tester();
$bulktestresults = $bulktester->qtype_stack_test_question($question, $testscases, $deployedseed, true);
// Print out question notes of all deployed versions.
$qn = question_bank::load_question($questionid);
$qn->seed = (int) $deployedseed;
......@@ -183,6 +188,7 @@ if (!$question->has_random_variants()) {
$notestable->data[] = array(
$choice,
stack_ouput_castext($qn->get_question_summary()),
$bulktestresults[1]
);
}
......
......@@ -130,7 +130,7 @@ class stack_bulk_tester {
* bool true if the tests passed, else false.
* sring message summarising the number of passes and fails.
*/
public function qtype_stack_test_question($question, $tests, $seed = null) {
public function qtype_stack_test_question($question, $tests, $seed = null, $quiet = false) {
flush(); // Force output to prevent timeouts and to make progress clear.
core_php_time_limit::raise(60); // Prevent PHP timeouts.
gc_collect_cycles(); // Because PHP's default memory management is rubbish.
......@@ -163,7 +163,9 @@ class stack_bulk_tester {
}
$message = stack_string('testpassesandfails', array('passes' => $passes, 'fails' => $fails));
if (!$quiet) {
echo html_writer::tag('p', $flag.$message, array('class' => $class));
}
flush(); // Force output to prevent timeouts and to make progress clear.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment