MDL-20636 Fix codechecker issues in the question behaviours.

This commit is contained in:
Tim Hunt 2011-04-08 07:24:24 +01:00
parent 9447399c11
commit 1631ceeaec
21 changed files with 147 additions and 86 deletions

View file

@ -55,14 +55,17 @@ class qbehaviour_missing extends question_behaviour {
}
public function init_first_step(question_attempt_step $step) {
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. ' .
'No processing is possible.');
}
public function process_action(question_attempt_pending_step $pendingstep) {
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. ' .
'No processing is possible.');
}
public function get_min_fraction() {
throw new coding_exception('The behaviour used for this question is not available. No processing is possible.');
throw new coding_exception('The behaviour used for this question is not available. ' .
'No processing is possible.');
}
}

View file

@ -63,13 +63,16 @@ class qbehaviour_missing_test extends UnitTestCase {
public function test_render_missing() {
$records = testing_db_record_builder::build_db_records(array(
array('id', 'questionattemptid', 'contextid', 'questionusageid', 'slot',
'behaviour', 'questionid', 'maxmark', 'minfraction', 'flagged',
'questionsummary', 'rightanswer', 'responsesummary', 'timemodified',
'attemptstepid', 'sequencenumber', 'state', 'fraction',
'timecreated', 'userid', 'name', 'value'),
array(1, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '', 1256233790, 1, 0, 'todo', null, 1256233700, 1, '_order', '1,2,3'),
array(2, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '', 1256233790, 2, 1, 'complete', 0.50, 1256233705, 1, '-submit', '1'),
array(3, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '', 1256233790, 2, 1, 'complete', 0.50, 1256233705, 1, 'choice0', '1'),
'behaviour', 'questionid', 'maxmark', 'minfraction', 'flagged',
'questionsummary', 'rightanswer', 'responsesummary',
'timemodified', 'attemptstepid', 'sequencenumber', 'state', 'fraction',
'timecreated', 'userid', 'name', 'value'),
array(1, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '',
1256233790, 1, 0, 'todo', null, 1256233700, 1, '_order', '1,2,3'),
array(2, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '',
1256233790, 2, 1, 'complete', 0.50, 1256233705, 1, '-submit', '1'),
array(3, 1, 123, 1, 1, 'strangeunknown', -1, 2.0000000, 0.0000000, 0, '', '', '',
1256233790, 2, 1, 'complete', 0.50, 1256233705, 1, 'choice0', '1'),
));
$question = test_question_maker::make_a_truefalse_question();
@ -99,7 +102,8 @@ class qbehaviour_missing_test extends UnitTestCase {
$output = $qa->render(new question_display_options(), '1');
$this->assertPattern('/' . preg_quote($qa->get_question()->questiontext) . '/', $output);
$this->assertPattern('/' . preg_quote(get_string('questionusedunknownmodel', 'qbehaviour_missing')) . '/', $output);
$this->assertPattern('/' . preg_quote(
get_string('questionusedunknownmodel', 'qbehaviour_missing')) . '/', $output);
$this->assert(new ContainsTagWithAttribute('div', 'class', 'warning'), $output);
}
}