}
    set_time_limit(30);
    list($passed, $phpvalid, $phpcasstring, $error, $casvalid, $caserrors, $casdisplay, $casvalue, $answernote) = stack_inputvalidation_test_data::run_test($test);
    $allpassed = $allpassed && $passed;
    if ($passed) {
        $class = 'pass';
        $passedcol = stack_string('testsuitepass');
    } else {
        $class = 'fail';
        $passedcol = stack_string('testsuitefail');
    }
    $display = '';
    if ('' != $casdisplay) {
        $display = '\\(' . $casdisplay . '\\)';
    }
    $row = array('passed' => $passedcol, 'studentanswer' => s($test->rawstring), 'phpvalid' => s($phpvalid), 'phpcasstring' => s($phpcasstring), 'answernote' => $answernote, 'error' => $error, 'casvalid' => s($casvalid), 'casvalue' => $casvalue, 'casdisplay' => format_text(stack_maths::process_lang_string(s($display))) . html_writer::tag('pre', s($casdisplay)), 'caserrors' => $caserrors);
    $table->add_data_keyed($row, $class);
    flush();
}
$table->finish_output();
// Overall summary.
$took = microtime(true) - $start;
$rtook = round($took, 5);
$pertest = round($took / $notests, 5);
echo '<p>' . stack_string('testsuitenotests', array('no' => $notests));
echo '<br/>' . stack_string('testsuiteteststook', array('time' => $rtook));
echo '<br/>' . stack_string('testsuiteteststookeach', array('time' => $pertest));
echo '</p>';
$config = get_config('qtype_stack');
echo html_writer::tag('p', stack_string('healthcheckcache_' . $config->casresultscache));
// Overall summary.
示例#2
0
/**
 * Equivalent to get_string($key, 'qtype_stack', $a), but this method ensure that
 * any equations in the string are displayed properly.
 * @param string $key the string name.
 * @param mixed $a (optional) any values to interpolate into the string.
 * @return string the language string
 */
function stack_string($key, $a = null)
{
    return stack_maths::process_lang_string(get_string($key, 'qtype_stack', $a));
}