.
/**
* Tests of the upgrade to the new Moodle question engine for attempts at
* essay questions.
*
* @package qtype
* @subpackage essay
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/question/engine/upgrade/tests/helper.php');
/**
* Testing the upgrade of essay question attempts.
*
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_essay_attempt_upgrader_test extends question_attempt_upgrader_test_base {
public function test_essay_deferredfeedback_history98220() {
$quiz = (object) array(
'id' => '4140',
'course' => '5012',
'name' => 'M887 Online Examination: 19th April 2010, 10am - 1pm',
'intro' => '
B680 is pioneering the use of the eAssessment module in the OU VLE (Virtual Learning Environment). We believe that the module is fit for purpose but we need users\' (students and ALs) experience to confirm this. Your answers to this short questionnaire therefore are of wide importance to the OU VLE Development Programme. If you could complete this short questionnaire after attempting Practice CTMA04 it would be greatly appreciated.
The questionnaire has 15 questions and we would like you to answer as many of these as possible. When you have completed your answers you will see a End test button, similar to the one in Practice CTMA 04, which you will need to click. This will move you to a Summary page. Please click the \'Submit all and finish\' button when you are happy to submit your final answers. Please complete the questionnaire only once. At a later stage the B680 Course Team will analyse the students\' answers to the questions.
',
'questiontextformat' => '1',
'defaultmark' => '0',
'penalty' => '0',
'qtype' => 'essay',
'length' => '1',
'stamp' => 'learn.open.ac.uk+070312094434+k2HaUF',
'version' => 'learn.open.ac.uk+070501173219+spx2IM',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => null,
'modifiedby' => null,
'unlimited' => null,
'maxmark' => '0',
'options' => (object) array(
'answers' => array(
11264 => (object) array(
'question' => '3729',
'answer' => '',
'fraction' => '0',
'feedback' => '',
'id' => 11264,
),
),
),
'hints' => false,
);
$qsession = (object) array(
'id' => '47133',
'attemptid' => '4246',
'questionid' => '3729',
'newest' => '107502',
'newgraded' => '107407',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
107407 => (object) array(
'attempt' => '4246',
'question' => '3729',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1179134211',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 107407,
),
107484 => (object) array(
'attempt' => '4246',
'question' => '3729',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => 'it would be better to point our a \'red colour\' on the number which indicates the questions that we have done wrong. similar to previously, from question 1 to 10, green colour shows the right answer and red colour shows the wrong answer, so that we do not need to click on each answer to find out if it is right or wrong.',
'timestamp' => '1179134869',
'event' => '2',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 107484,
),
107502 => (object) array(
'attempt' => '4246',
'question' => '3729',
'originalquestion' => '0',
'seq_number' => '2',
'answer' => 'it would be better to point our a \'red colour\' on the number which indicates the questions that we have done wrong. similar to previously, from question 1 to 10, green colour shows the right answer and red colour shows the wrong answer, so that we do not need to click on each answer to find out if it is right or wrong.',
'timestamp' => '1179134869',
'event' => '8',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 107502,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'manualgraded',
'questionid' => 3729,
'variant' => 1,
'maxmark' => 0,
'minfraction' => 0,
'maxfraction' => 1,
'flagged' => 0,
'questionsummary' => "If you answered ‘No’ to the previous question please expand on your problem here.",
'rightanswer' => '',
'responsesummary' => 'it would be better to point our a \'red colour\' on the number which indicates the questions that we have done wrong. similar to previously, from question 1 to 10, green colour shows the right answer and red colour shows the wrong answer, so that we do not need to click on each answer to find out if it is right or wrong.',
'timemodified' => 1179134869,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1179134211,
'userid' => 96864,
'data' => array(),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1179134869,
'userid' => 96864,
'data' => array('answer' => 'it would be better to point our a \'red colour\' on the number which indicates the questions that we have done wrong. similar to previously, from question 1 to 10, green colour shows the right answer and red colour shows the wrong answer, so that we do not need to click on each answer to find out if it is right or wrong.', 'answerformat' => FORMAT_HTML),
),
2 => (object) array(
'sequencenumber' => 2,
'state' => 'needsgrading',
'fraction' => null,
'timecreated' => 1179134869,
'userid' => 96864,
'data' => array('-finish' => 1, 'answer' => 'it would be better to point our a \'red colour\' on the number which indicates the questions that we have done wrong. similar to previously, from question 1 to 10, green colour shows the right answer and red colour shows the wrong answer, so that we do not need to click on each answer to find out if it is right or wrong.', 'answerformat' => FORMAT_HTML),
),
),
);
$this->compare_qas($expectedqa, $qa);
}
public function test_essay_deferredfeedback_missing() {
$quiz = (object) array(
'id' => '142',
'course' => '187',
'name' => 'Questionnaire',
'intro' => '
B680 is pioneering the use of the eAssessment module in the OU VLE (Virtual Learning Environment). We believe that the module is fit for purpose but we need users\' (students and ALs) experience to confirm this. Your answers to this short questionnaire therefore are of wide importance to the OU VLE Development Programme. If you could complete this short questionnaire after attempting Practice CTMA04 it would be greatly appreciated.
The questionnaire has 15 questions and we would like you to answer as many of these as possible. When you have completed your answers you will see a End test button, similar to the one in Practice CTMA 04, which you will need to click. This will move you to a Summary page. Please click the \'Submit all and finish\' button when you are happy to submit your final answers. Please complete the questionnaire only once. At a later stage the B680 Course Team will analyse the students\' answers to the questions.