MDL-20636 Question engine upgrade unit tests for description, essay, match and numerical.

This commit is contained in:
Tim Hunt 2011-05-11 18:17:11 +01:00
parent d04626e4cd
commit fca599a683
4 changed files with 2069 additions and 0 deletions

View File

@ -0,0 +1,457 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests of the upgrade to the new Moodle question engine for attempts at
* description questions.
*
* @package qtype
* @subpackage description
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php');
/**
* Testing the upgrade of description question attempts.
*
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_description_attempt_upgrader_test extends question_attempt_upgrader_test_base {
public function test_description_deferredfeedback_history80() {
$quiz = (object) array(
'id' => '278',
'course' => '2950',
'name' => 'test quiz 1',
'intro' => 'my demonstration quiz ',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71727591',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '1',
'questions' => '4940,0,5043,0,4945,0,4942,0,5566,0',
'sumgrades' => '5',
'grade' => '10',
'timecreated' => '0',
'timemodified' => '1178101987',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '6802',
'uniqueid' => '6802',
'quiz' => '278',
'userid' => '13',
'attempt' => '1',
'sumgrades' => '2.33333',
'timestart' => '1185289572',
'timefinish' => '1185289637',
'timemodified' => '1185289590',
'layout' => '4940,0,5043,0,4945,0,4942,0,5566,0',
'preview' => '1',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '4940',
'category' => '247',
'parent' => '0',
'name' => 'Northampton Gallery Case Study',
'questiontext' => 'The following questions are based on the Northampton Art Gallery case study and associated web links. The questions cover artists and works that were available during the study weeks for Block 3. Some items may no longer be available on websites but will be available in the readings for Block 3.',
'questiontextformat' => '1',
'defaultmark' => '0',
'penalty' => '0',
'qtype' => 'description',
'length' => '1',
'stamp' => 'learn.open.ac.uk+070501114616+rtsfKk',
'version' => 'learn.open.ac.uk+070501114616+ZY94d5',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '1',
);
$qsession = (object) array(
'id' => '130459',
'attemptid' => '6802',
'questionid' => '4940',
'newest' => '297740',
'newgraded' => '297730',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
297730 => (object) array(
'attempt' => '6802',
'question' => '4940',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1185289572',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 297730,
),
297740 => (object) array(
'attempt' => '6802',
'question' => '4940',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '',
'timestamp' => '1185289572',
'event' => '8',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 297740,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'informationitem',
'questionid' => 4940,
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => 'The following questions are based on the Northampton Art Gallery case study and associated web links. The questions cover artists and works that were available during the study weeks for Block 3. Some items may no longer be available on websites but will be available in the readings for Block 3.',
'rightanswer' => '',
'responsesummary' => '',
'timemodified' => 1185289572,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1185289572,
'userid' => 13,
'data' => array(),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'finished',
'fraction' => null,
'timecreated' => 1185289572,
'userid' => 13,
'data' => array('-finish' => 1),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
public function test_description_deferredfeedback_history70() {
$quiz = (object) array(
'id' => '442',
'course' => '2591',
'name' => 'Needs Analysis (online version)',
'intro' => '<h3>Information </h3>The purpose of the Needs Analysis is to help you identify your professional development needs and those programme modules which will best address them. <br /><br />This Needs Analysis will form the basis of a discussion with your mentor from which will emerge your Professional Development Plan (PDP). Identifying professional development needs is an integral part of the process of professional development. The PDP and the subsequent professional development opportunities it identifies will be effective only if the Needs Analysis is completed fully and accurately. You will get much more out of the programme if you give plenty of time at this early stage to the Needs Analysis. <br /><br /><h3>1. Personal and Professional Information</h3>In addition to personal information you will be asked to outline any professional qualifications and experience to date. <br /><br /><h3>2. Professional and Musical Skills</h3>In this section you will be asked to record your skills, knowledge and experience against a range of professional activities which closely relate to the focus of the music CPD programme. You will be asked to provide brief examples of evidence of those areas in which you have significant experience. <br /><br /><h3>3. Issues in Music Teaching and Learning</h3>This section is organised under three areas: Learning Musically, Teaching Musically and Making Music. <br /><br />In this section we ask you to audit your knowledge, skills and understanding against the key issues covered by the online and face-to-face module units. You will be invited to identify your strengths and provide evidence of your experience and understanding. <br /><br />',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '1',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71719269',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '8492,0,8487,8488,8489,8490,0,8441,0,8443,0,8486,0,8444,0,8445,0,8494,0,8446,8429,0,8447,8430,0,8448,8431,0,8449,8432,0,8450,8433,0,8451,8434,0,8452,8435,0,8453,8436,0,8454,8437,0,8493,0,8455,8456,8457,0,8458,8459,8460,0,8461,8462,8463,8438,0,8464,8465,8466,0,8467,8468,8469,0,8470,8471,8472,8439,0,8473,8440,0,8474,8475,8476,0,8477,8478,8479,0,8480,8481,8482,0,8483,8484,8485,8442,0',
'sumgrades' => '0',
'grade' => '10',
'timecreated' => '0',
'timemodified' => '1202212400',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '11230',
'uniqueid' => '11230',
'quiz' => '442',
'userid' => '193184',
'attempt' => '1',
'sumgrades' => '0',
'timestart' => '1192648793',
'timefinish' => '1192742609',
'timemodified' => '1192742300',
'layout' => '8492,0,8487,8488,8489,8490,0,8441,0,8443,0,8486,0,8444,0,8445,0,8494,0,8446,8429,0,8447,8430,0,8448,8431,0,8449,8432,0,8450,8433,0,8451,8434,0,8452,8435,0,8453,8436,0,8454,8437,0,8493,0,8455,8456,8457,0,8458,8459,8460,0,8461,8462,8463,8438,0,8464,8465,8466,0,8467,8468,8469,0,8470,8471,8472,8439,0,8473,8440,0,8474,8475,8476,0,8477,8478,8479,0,8480,8481,8482,0,8483,8484,8485,8442,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '8492',
'category' => '131',
'parent' => '0',
'name' => 'Personal and Professional Information',
'questiontext' => '<h3>Personal and Professional Information</h3><br />Here we want you to enter personal information and outline your professional qualifications and experience to date.',
'questiontextformat' => '1',
'defaultmark' => '0',
'penalty' => '0',
'qtype' => 'description',
'length' => '0',
'stamp' => 'learn.open.ac.uk+070808083925+qTmPpB',
'version' => 'learn.open.ac.uk+070907143809+3ltY7I',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '0',
);
$qsession = (object) array(
'id' => '206424',
'attemptid' => '11230',
'questionid' => '8492',
'newest' => '480877',
'newgraded' => '476039',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
476039 => (object) array(
'attempt' => '11230',
'question' => '8492',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1192648793',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 476039,
),
480877 => (object) array(
'attempt' => '11230',
'question' => '8492',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '',
'timestamp' => '1192648793',
'event' => '7',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 480877,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'informationitem',
'questionid' => 8492,
'maxmark' => 0,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => "PERSONAL AND PROFESSIONAL INFORMATION\n\nHere we want you to enter personal information and outline your professional qualifications and experience to date.",
'rightanswer' => '',
'responsesummary' => '',
'timemodified' => 1192648793,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1192648793,
'userid' => 193184,
'data' => array(),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'finished',
'fraction' => null,
'timecreated' => 1192648793,
'userid' => 193184,
'data' => array('-finish' => 1),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
public function test_description_deferredfeedback_history0() {
$quiz = (object) array(
'id' => '466',
'course' => '3464',
'name' => 'Music CPD Needs Analysis',
'intro' => '<h3>Information </h3>The purpose of the Needs Analysis is to help you identify your professional development needs and those programme modules which will best address them. <br /><br />This Needs Analysis will form the basis of a discussion with your mentor from which will emerge your Professional Development Plan (PDP). Identifying professional development needs is an integral part of the process of professional development. The PDP and the subsequent professional development opportunities it identifies will be effective only if the Needs Analysis is completed fully and accurately. You will get much more out of the programme if you give plenty of time at this early stage to the Needs Analysis. <br /><br />
<h3>1. Personal and Professional Information</h3>In addition to personal information you will be asked to outline any professional qualifications and experience to date. <br /><br />
<h3>2. Professional and Musical Skills</h3>In this section you will be asked to record your skills, knowledge and experience against a range of professional activities which closely relate to the focus of the music CPD programme. You will be asked to provide brief examples of evidence of those areas in which you have significant experience. <br /><br />
<h3>3. Issues in Music Teaching and Learning</h3>This section is organised under three areas: Learning Musically, Teaching Musically and Making Music. <br /><br />In this section we ask you to audit your knowledge, skills and understanding against the key issues covered by the online and face-to-face module units. You will be invited to identify your strengths and provide evidence of your experience and understanding. <br /> <br />',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '1',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71719269',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '8691,0,8690,8692,8693,8694,0,8695,0,8696,0,8697,0,8698,0,8699,0,8700,0,8701,8702,0,8703,8704,0,8705,8706,0,8707,8708,0,8709,8710,0,8711,8712,0,8713,8714,0,8715,8716,0,8717,8718,0,8719,0,8720,8721,8722,0,8723,8724,8725,0,8726,8727,8728,8729,0,8730,8731,8732,0,8733,8734,8735,0,8736,8737,8738,8739,0,8740,8741,0,8742,8743,8744,0,8745,8746,8747,0,8748,8749,8750,0,8752,8751,8753,8754,0',
'sumgrades' => '0',
'grade' => '10',
'timecreated' => '0',
'timemodified' => '1184685800',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '7401',
'uniqueid' => '7401',
'quiz' => '466',
'userid' => '24474',
'attempt' => '1',
'sumgrades' => '0',
'timestart' => '1187168654',
'timefinish' => '0',
'timemodified' => '1187168769',
'layout' => '8691,0,8690,8692,8693,8694,0,8695,0,8696,0,8697,0,8698,0,8699,0,8700,0,8701,8702,0,8703,8704,0,8705,8706,0,8707,8708,0,8709,8710,0,8711,8712,0,8713,8714,0,8715,8716,0,8717,8718,0,8719,0,8720,8721,8722,0,8723,8724,8725,0,8726,8727,8728,8729,0,8730,8731,8732,0,8733,8734,8735,0,8736,8737,8738,8739,0,8740,8741,0,8742,8743,8744,0,8745,8746,8747,0,8748,8749,8750,0,8752,8751,8753,8754,0',
'preview' => '1',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '8719',
'category' => '427',
'parent' => '0',
'name' => 'Music Teaching and Learning',
'questiontext' => '<h3>Music Teaching and Learning </h3><br />In this section we ask you to audit your knowledge, skills and understanding against the key issues covered by the non-core online and face-to-face module units. You will be invited to identify your strengths and provide evidence of your experience and understanding.<br /><br />In this set of questions, you should select from the drop-down menu None, Some, Good or Strong.<br /><br />',
'questiontextformat' => '1',
'defaultmark' => '0',
'penalty' => '0',
'qtype' => 'description',
'length' => '0',
'stamp' => 'learn.open.ac.uk+070430145701+r8LVld',
'version' => 'learn.open.ac.uk+070430145834+FxIAjw',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '0',
);
$qsession = (object) array(
'id' => '157658',
'attemptid' => '7401',
'questionid' => '8719',
'newest' => '361166',
'newgraded' => '361166',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
361166 => (object) array(
'attempt' => '7401',
'question' => '8719',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1187168654',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 361166,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'informationitem',
'questionid' => 8719,
'maxmark' => 0,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => "MUSIC TEACHING AND LEARNING \n\nIn this section we ask you to audit your knowledge, skills and understanding against the key issues covered by the non-core online and face-to-face module units. You will be invited to identify your strengths and provide evidence of your experience and understanding.\n\nIn this set of questions, you should select from the drop-down menu None, Some, Good or Strong.",
'rightanswer' => '',
'responsesummary' => '',
'timemodified' => 1187168654,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1187168654,
'userid' => 24474,
'data' => array(),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
}

View File

@ -0,0 +1,563 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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();
require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/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_history97220() {
$quiz = (object) array(
'id' => '4140',
'course' => '5012',
'name' => 'M887 Online Examination: 19th April 2010, 10am - 1pm',
'intro' => '<h2>M887 Examination Paper 19th April 2010</h2>
<h2>Postgraduate Computing<br />Web Systems Integration<br /></h2>
<h2>Begin by pressing Start Attempt (below)</h2>',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '1271665800',
'timeclose' => '1271682000',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '1',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71727591',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '1',
'questions' => '90042,0,90043,0,90045,0,90052,0,90053,0,90054,0,90055,0,90056,0,90057,0,90058,0,90059,0,90046,0,90044,0,90047,0,90048,0,90049,0',
'sumgrades' => '100',
'grade' => '100',
'timecreated' => '0',
'timemodified' => '1272274569',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '388325',
'uniqueid' => '388326',
'quiz' => '4140',
'userid' => '118065',
'attempt' => '1',
'sumgrades' => '51',
'timestart' => '1271667586',
'timefinish' => '1271678351',
'timemodified' => '1273069013',
'layout' => '90042,0,90043,0,90045,0,90052,0,90053,0,90054,0,90055,0,90056,0,90057,0,90058,0,90059,0,90046,0,90044,0,90047,0,90048,0,90049,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '90056',
'category' => '8619',
'parent' => '0',
'name' => 'Question 6',
'questiontext' => '<p>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><meta name="ProgId" content="Word.Document"></meta><meta name="Generator" content="Microsoft Word 11"></meta><meta name="Originator" content="Microsoft Word 11"></meta><link rel="File-List" href="file:///C:\\DOCUME~1\\pgt2\\LOCALS~1\\Temp\\msohtml1\\01\\clip_filelist.xml"></link><style></style>Give two examples of facilities within XML schemas that cannot be found in Document Type Definitions (DTDs).<br /><i>(2 marks)</i></p>',
'questiontextformat' => '1',
'defaultmark' => '2',
'penalty' => '0',
'qtype' => 'essay',
'length' => '1',
'stamp' => 'learn.open.ac.uk+100205101651+5eB30s',
'version' => 'learn.open.ac.uk+100209161823+oZCX9n',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '1265365011',
'timemodified' => '1265732303',
'createdby' => '219095',
'modifiedby' => '25483',
'unlimited' => '0',
'maxmark' => '2',
'options' => (object) array(
'answers' => array(
303772 => (object) array(
'question' => '90056',
'answer' => '',
'fraction' => '0',
'feedback' => '',
'id' => 303772,
),
),
),
'hints' => false,
);
$qsession = (object) array(
'id' => '3962570',
'attemptid' => '388326',
'questionid' => '90056',
'newest' => '10517712',
'newgraded' => '10517712',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
10094242 => (object) array(
'attempt' => '388326',
'question' => '90056',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1271667586',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 10094242,
),
10096161 => (object) array(
'attempt' => '388326',
'question' => '90056',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '<p>Variable typeing</p>
<p>Namespaces</p>',
'timestamp' => '1271670445',
'event' => '2',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 10096161,
),
10097144 => (object) array(
'attempt' => '388326',
'question' => '90056',
'originalquestion' => '0',
'seq_number' => '2',
'answer' => '<p>Variable can be typed</p>
<p>xml Schemas fully support Namespaces</p>',
'timestamp' => '1271671440',
'event' => '2',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 10097144,
),
10103710 => (object) array(
'attempt' => '388326',
'question' => '90056',
'originalquestion' => '0',
'seq_number' => '3',
'answer' => '<p>Variable can be typed</p>
<p>xml Schemas fully support Namespaces</p>',
'timestamp' => '1271671440',
'event' => '7',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 10103710,
),
10517712 => (object) array(
'attempt' => '388326',
'question' => '90056',
'originalquestion' => '0',
'seq_number' => '4',
'answer' => '<p>Variable can be typed</p>
<p>xml Schemas fully support Namespaces</p>',
'timestamp' => '1273068477',
'event' => '9',
'grade' => '2',
'raw_grade' => '2',
'penalty' => '0',
'id' => 10517712,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'manualgraded',
'questionid' => 90056,
'maxmark' => 2,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => "* Give two examples of facilities within XML schemas that cannot be found in Document Type Definitions (DTDs).\n_(2 marks)_",
'rightanswer' => '',
'responsesummary' => "Variable can be typed \n\nxml Schemas fully support Namespaces",
'timemodified' => 1273068477,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1271667586,
'userid' => 118065,
'data' => array(),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1271670445,
'userid' => 118065,
'data' => array('answer' => '<p>Variable typeing</p>
<p>Namespaces</p>'),
),
2 => (object) array(
'sequencenumber' => 2,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1271671440,
'userid' => 118065,
'data' => array('answer' => '<p>Variable can be typed</p>
<p>xml Schemas fully support Namespaces</p>'),
),
3 => (object) array(
'sequencenumber' => 3,
'state' => 'needsgrading',
'fraction' => null,
'timecreated' => 1271671440,
'userid' => 118065,
'data' => array('answer' => '<p>Variable can be typed</p>
<p>xml Schemas fully support Namespaces</p>', '-finish' => 1),
),
4 => (object) array(
'sequencenumber' => 4,
'state' => 'mangrright',
'fraction' => 1,
'timecreated' => 1273068477,
'userid' => null,
'data' => array('-comment' => '', '-mark' => 2, '-maxmark' => 2),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
public function test_essay_deferredfeedback_history820() {
$quiz = (object) array(
'id' => '142',
'course' => '187',
'name' => 'Questionnaire',
'intro' => '<p>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 <b></b>it would be greatly appreciated.</p>
<p>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. <strong>Please complete the questionnaire only once.</strong> At a later stage the B680 Course Team will analyse the students\' answers to the questions. <br /></p>',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71727591',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '3664,3716,0,3663,3717,0,3718,3719,0,3720,0,3733,3727,0,3728,3730,0,3731,3732,0,3726,3729,0',
'sumgrades' => '0',
'grade' => '0',
'timecreated' => '0',
'timemodified' => '1178202609',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '4246',
'uniqueid' => '4246',
'quiz' => '142',
'userid' => '96864',
'attempt' => '1',
'sumgrades' => '0',
'timestart' => '1179134211',
'timefinish' => '1179134998',
'timemodified' => '1179134869',
'layout' => '3664,3716,0,3663,3717,0,3718,3719,0,3720,0,3733,3727,0,3728,3730,0,3731,3732,0,3726,3729,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '3729',
'category' => '163',
'parent' => '0',
'name' => 'Question 98',
'questiontext' => 'If you answered No to the previous question please expand on your problem here.<br /><b></b><br />',
'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,
'maxmark' => 0,
'minfraction' => 0,
'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.'),
),
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.'),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
public function test_essay_deferredfeedback_missing() {
$quiz = (object) array(
'id' => '142',
'course' => '187',
'name' => 'Questionnaire',
'intro' => '<p>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 <b></b>it would be greatly appreciated.</p>
<p>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. <strong>Please complete the questionnaire only once.</strong> At a later stage the B680 Course Team will analyse the students\' answers to the questions. <br /></p>',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71727591',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '3664,3716,0,3663,3717,0,3718,3719,0,3720,0,3733,3727,0,3728,3730,0,3731,3732,0,3726,3729,0',
'sumgrades' => '0',
'grade' => '0',
'timecreated' => '0',
'timemodified' => '1178202609',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '4246',
'uniqueid' => '4246',
'quiz' => '142',
'userid' => '96864',
'attempt' => '1',
'sumgrades' => '0',
'timestart' => '1179134211',
'timefinish' => '1179134998',
'timemodified' => '1179134869',
'layout' => '3664,3716,0,3663,3717,0,3718,3719,0,3720,0,3733,3727,0,3728,3730,0,3731,3732,0,3726,3729,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '3729',
'category' => '163',
'parent' => '0',
'name' => 'Question 98',
'questiontext' => 'If you answered No to the previous question please expand on your problem here.<br /><b></b><br />',
'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,
);
$qa = $this->updater->supply_missing_question_attempt( $quiz, $attempt, $question);
$expectedqa = (object) array(
'behaviour' => 'manualgraded',
'questionid' => 3729,
'maxmark' => 0,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => "If you answered No to the previous question please expand on your problem here.",
'rightanswer' => '',
'responsesummary' => '',
'timemodified' => 1179134211,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1179134211,
'userid' => 96864,
'data' => array(),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
}

View File

@ -0,0 +1,784 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests of the upgrade to the new Moodle question engine for attempts at
* match questions.
*
* @package qtype
* @subpackage match
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php');
/**
* Testing the upgrade of match question attempts.
*
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_attempt_upgrader_test extends question_attempt_upgrader_test_base {
public function test_match_deferredfeedback_history6220() {
$quiz = (object) array(
'id' => '72',
'course' => '1181',
'name' => 'Study Guide 4 Quiz',
'intro' => '',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '1',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71760879',
'questionsperpage' => '2',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '689,690,0,691,692,0,693,694,0,695,696,0,697,698,0',
'sumgrades' => '48',
'grade' => '48',
'timecreated' => '0',
'timemodified' => '1170427370',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '3562',
'uniqueid' => '3562',
'quiz' => '72',
'userid' => '91483',
'attempt' => '6',
'sumgrades' => '43',
'timestart' => '1177419915',
'timefinish' => '1177419962',
'timemodified' => '1168015476',
'layout' => '689,690,0,691,692,0,693,694,0,695,696,0,697,698,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '695',
'category' => '65',
'parent' => '0',
'name' => 'Question 7',
'questiontext' => '<p>Associate the appropriate definition with each term.</p>',
'questiontextformat' => '1',
'defaultmark' => '1',
'penalty' => '0',
'qtype' => 'match',
'length' => '1',
'stamp' => 'learn.open.ac.uk+061123110024+a0RsuG',
'version' => 'learn.open.ac.uk+061123163015+Oe63zC',
'hidden' => '0',
'generalfeedback' => 'For further information about this question see Study Guide 4 SAQ 3.1',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '3',
'options' => (object) array(
'id' => '27',
'question' => '695',
'subquestions' => array(
148 => (object) array(
'code' => '511093512',
'question' => '695',
'questiontext' => 'Active adjacent system',
'answertext' => 'A system that interacts with or participates in the work.',
'id' => 148,
),
149 => (object) array(
'code' => '10881658',
'question' => '695',
'questiontext' => 'Autonomous adjacent system',
'answertext' => 'An external entity that acts independently of the work under study.',
'id' => 149,
),
150 => (object) array(
'code' => '661953276',
'question' => '695',
'questiontext' => 'Cooperative adjacent system',
'answertext' => 'A system that is involved in the response to a business event.',
'id' => 150,
),
151 => (object) array(
'code' => '786218388',
'question' => '695',
'questiontext' => '',
'answertext' => 'A system which does not supply or receive data from the work.',
'id' => 151,
),
152 => (object) array(
'code' => '166673328',
'question' => '695',
'questiontext' => '',
'answertext' => 'An external entity that performs part of the work under study.',
'id' => 152,
),
),
'shuffleanswers' => '1',
'correctfeedback' => '',
'partiallycorrectfeedback' => '',
'incorrectfeedback' => '',
'correctresponsesfeedback' => '0',
),
'hints' => false,
);
$qsession = (object) array(
'id' => '33092',
'attemptid' => '3562',
'questionid' => '695',
'newest' => '79626',
'newgraded' => '79626',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
79604 => (object) array(
'attempt' => '3562',
'question' => '695',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '148-0,149-0,150-0,151-0,152-0',
'timestamp' => '1177419915',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 79604,
),
79614 => (object) array(
'attempt' => '3562',
'question' => '695',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '148-511093512,149-786218388,150-166673328,151-0,152-0',
'timestamp' => '1177419855',
'event' => '2',
'grade' => '0',
'raw_grade' => '1',
'penalty' => '0',
'id' => 79614,
),
79619 => (object) array(
'attempt' => '3562',
'question' => '695',
'originalquestion' => '0',
'seq_number' => '2',
'answer' => '148-511093512,149-10881658,150-661953276,151-0,152-0',
'timestamp' => '1177419956',
'event' => '2',
'grade' => '0',
'raw_grade' => '3',
'penalty' => '0',
'id' => 79619,
),
79626 => (object) array(
'attempt' => '3562',
'question' => '695',
'originalquestion' => '0',
'seq_number' => '3',
'answer' => '148-511093512,149-10881658,150-661953276,151-0,152-0',
'timestamp' => '1177419956',
'event' => '6',
'grade' => '3',
'raw_grade' => '3',
'penalty' => '0',
'id' => 79626,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'deferredfeedback',
'questionid' => 695,
'maxmark' => 3,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => 'Associate the appropriate definition with each term. {Active adjacent system; Autonomous adjacent system; Cooperative adjacent system} -> {A system that interacts with or participates in the work.; An external entity that acts independently of the work under study.; A system that is involved in the response to a business event.; A system which does not supply or receive data from the work.; An external entity that performs part of the work under study.}',
'rightanswer' => 'Active adjacent system -> A system that interacts with or participates in the work.; Autonomous adjacent system -> An external entity that acts independently of the work under study.; Cooperative adjacent system -> A system that is involved in the response to a business event.',
'responsesummary' => 'Active adjacent system -> A system that interacts with or participates in the work.; Autonomous adjacent system -> An external entity that acts independently of the work under study.; Cooperative adjacent system -> A system that is involved in the response to a business event.',
'timemodified' => 1177419956,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1177419915,
'userid' => 91483,
'data' => array('_stemorder' => '148,149,150', '_choiceorder' => 'todo - see below'),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1177419855,
'userid' => 91483,
'data' => array('sub0' => 148, 'sub1' => 151, 'sub2' => 152),
),
2 => (object) array(
'sequencenumber' => 2,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1177419956,
'userid' => 91483,
'data' => array('sub0' => 148, 'sub1' => 149, 'sub2' => 150),
),
3 => (object) array(
'sequencenumber' => 3,
'state' => 'gradedright',
'fraction' => 1,
'timecreated' => 1177419956,
'userid' => 91483,
'data' => array('sub0' => 148, 'sub1' => 149, 'sub2' => 150, '-finish' => 1),
),
),
);
// This is a random thing, so just set expected to actual:
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
for ($i = 1; $i <= 3; $i++) {
for ($sub = 0; $sub < 3; $sub++) {
$expectedqa->steps[$i]->data['sub' . $sub] =
$order[$expectedqa->steps[$i]->data['sub' . $sub]] + 1;
}
}
$this->assertEqual($expectedqa, $qa);
}
public function test_match_deferredfeedback_history60() {
$quiz = (object) array(
'id' => '60',
'course' => '2304',
'name' => 'Types of resources available quiz',
'intro' => 'This quiz covers the different types of information resources available and how to select which is most appropriate. ',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '1164153600',
'timeclose' => '1606003200',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '3',
'review' => '71752557',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '509,0,510,0,511,0,738,0,514,0',
'sumgrades' => '5',
'grade' => '10',
'timecreated' => '0',
'timemodified' => '1170245956',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '1065',
'uniqueid' => '1065',
'quiz' => '60',
'userid' => '182682',
'attempt' => '1',
'sumgrades' => '3.99998',
'timestart' => '1168267317',
'timefinish' => '1168267508',
'timemodified' => '1168267508',
'layout' => '509,510,511,738,514,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '738',
'category' => '60',
'parent' => '0',
'name' => 'TR004',
'questiontext' => '<p>Which of the following statements about subject gateways are true, and which are false? </p>',
'questiontextformat' => '1',
'defaultmark' => '1',
'penalty' => '0.1',
'qtype' => 'match',
'length' => '1',
'stamp' => 'learn.open.ac.uk+061128151507+CLevuJ',
'version' => 'learn.open.ac.uk+070108115531+VvJurj',
'hidden' => '0',
'generalfeedback' => '<UL><LI>Subject gateways provide links to sites that have been quality checked = True</LI>
<LI>Subject gateways offer more variety than search engines = False</LI>
<LI>Subject gateways index websites automatically = False</LI>
<LI>Subject gateways can provide a more direct route to websites containing academic content = True</LI>
</UL>',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '1',
'options' => (object) array(
'id' => '35',
'question' => '738',
'subquestions' => array(
213 => (object) array(
'code' => '860968335',
'question' => '738',
'questiontext' => 'Subject gateways provide links to sites that have been quality checked ',
'answertext' => 'True',
'id' => 213,
),
214 => (object) array(
'code' => '253006016',
'question' => '738',
'questiontext' => 'Subject gateways offer more variety than search engines ',
'answertext' => 'False',
'id' => 214,
),
215 => (object) array(
'code' => '964910717',
'question' => '738',
'questiontext' => 'Subject gateways index websites automatically',
'answertext' => 'False',
'id' => 215,
),
216 => (object) array(
'code' => '3109713',
'question' => '738',
'questiontext' => 'Subject gateways can provide a more direct route to websites containing academic content ',
'answertext' => 'True',
'id' => 216,
),
),
'shuffleanswers' => '1',
'correctfeedback' => '',
'partiallycorrectfeedback' => '',
'incorrectfeedback' => '',
'correctresponsesfeedback' => '0',
),
'hints' => false,
);
$qsession = (object) array(
'id' => '9258',
'attemptid' => '1065',
'questionid' => '738',
'newest' => '24966',
'newgraded' => '24966',
'sumpenalty' => '0',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
24961 => (object) array(
'attempt' => '1065',
'question' => '738',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '213-0,214-0,215-0,216-0',
'timestamp' => '1168267317',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 24961,
),
24966 => (object) array(
'attempt' => '1065',
'question' => '738',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '213-860968335,214-253006016,215-964910717,216-3109713',
'timestamp' => '1168267508',
'event' => '6',
'grade' => '1',
'raw_grade' => '1',
'penalty' => '0.1',
'id' => 24966,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'deferredfeedback',
'questionid' => 738,
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => 'Which of the following statements about subject gateways are true, and which are false? {Subject gateways provide links to sites that have been quality checked; Subject gateways offer more variety than search engines; Subject gateways index websites automatically; Subject gateways can provide a more direct route to websites containing academic content} -> {True; False}',
'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
'responsesummary' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
'timemodified' => 1168267508,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1168267317,
'userid' => 182682,
'data' => array('_stemorder' => '213,214,215,216', '_choiceorder' => 'todo - see below'),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'gradedright',
'fraction' => 1,
'timecreated' => 1168267508,
'userid' => 182682,
'data' => array('sub0' => 213, 'sub1' => 214,'sub2' => 214,'sub3' => 213, '-finish' => 1),
),
),
);
// This is a random thing, so just set expected to actual:
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
for ($i = 1; $i <= 1; $i++) {
for ($sub = 0; $sub < 4; $sub++) {
$expectedqa->steps[$i]->data['sub' . $sub] =
$order[$expectedqa->steps[$i]->data['sub' . $sub]] + 1;
}
}
$this->assertEqual($expectedqa, $qa);
}
public function test_match_deferredfeedback_history622220() {
$quiz = (object) array(
'id' => '719',
'course' => '3541',
'name' => 'Types of resources quiz',
'intro' => '',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '0',
'timeclose' => '0',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71760879',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '1',
'questions' => '11163,0,11164,0,11165,0,11135,0,11166,0',
'sumgrades' => '5',
'grade' => '10',
'timecreated' => '0',
'timemodified' => '1193678199',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '23777',
'uniqueid' => '23777',
'quiz' => '719',
'userid' => '6584',
'attempt' => '1',
'sumgrades' => '3.91664',
'timestart' => '1200506648',
'timefinish' => '1200507571',
'timemodified' => '1200506959',
'layout' => '11163,0,11164,0,11165,0,11135,0,11166,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '11135',
'category' => '675',
'parent' => '0',
'name' => 'TR004',
'questiontext' => '<p>Which of the following statements about subject gateways are true, and which are false? </p>',
'questiontextformat' => '0',
'defaultmark' => '1',
'penalty' => '0.1',
'qtype' => 'match',
'length' => '1',
'stamp' => 'learn.open.ac.uk+071023110917+tqaM6z',
'version' => 'learn.open.ac.uk+071023110917+Ia7Hpz',
'hidden' => '0',
'generalfeedback' => '<ul>
<li>Subject gateways provide links to sites that have been quality checked = True </li>
</ul>
<p>All links in a subject gateway have been added by a knowledgeable subject specialist and so have to be of a certain quality to be added to the collection.</p>
<ul>
<li>Subject gateways offer more variety than search engines = False </li>
</ul>
<p>Subject gateways will most likely provide fewer links than a search engine, but this is because they are selected with a particular subject area in mind </p>
<ul>
<li>Subject gateways index websites automatically = False </li>
</ul>
<p>Subject gateways links are indexed by knowledgeable subject specialists rather than a machine. </p>
<ul>
<li>Subject gateways can provide a more direct route to websites containing academic content = True </li>
</ul>
<p>All links in a subject gateway have been added by a knowledgeable subject specialist and so you can find academic content easier than using a web search engine.</p>',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '1',
'options' => (object) array(
'id' => '279',
'question' => '11135',
'subquestions' => array(
1632 => (object) array(
'code' => '315604704',
'question' => '11135',
'questiontext' => 'Subject gateways provide links to sites that have been quality checked',
'answertext' => 'True',
'id' => 1632,
),
1633 => (object) array(
'code' => '750106618',
'question' => '11135',
'questiontext' => 'Subject gateways offer more variety than search engines',
'answertext' => 'False',
'id' => 1633,
),
1634 => (object) array(
'code' => '446418834',
'question' => '11135',
'questiontext' => 'Subject gateways index websites automatically',
'answertext' => 'False',
'id' => 1634,
),
1635 => (object) array(
'code' => '3262827',
'question' => '11135',
'questiontext' => 'Subject gateways can provide a more direct route to websites containing academic content',
'answertext' => 'True',
'id' => 1635,
),
),
'shuffleanswers' => '1',
'correctfeedback' => '',
'partiallycorrectfeedback' => '',
'incorrectfeedback' => '',
'correctresponsesfeedback' => '0',
),
'hints' => false,
);
$qsession = (object) array(
'id' => '356418',
'attemptid' => '23777',
'questionid' => '11135',
'newest' => '862740',
'newgraded' => '862740',
'sumpenalty' => '0.1',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
862587 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '1633-0,1635-0,1634-0,1632-0',
'timestamp' => '1200506648',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 862587,
),
862638 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '1633-750106618,1635-3262827,1634-0,1632-315604704',
'timestamp' => '1200507025',
'event' => '2',
'grade' => '0',
'raw_grade' => '0.75',
'penalty' => '0.1',
'id' => 862638,
),
862668 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '2',
'answer' => '1633-750106618,1635-3262827,1634-0,1632-315604704',
'timestamp' => '1200507125',
'event' => '2',
'grade' => '0',
'raw_grade' => '0.75',
'penalty' => '0.1',
'id' => 862668,
),
862673 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '3',
'answer' => '1633-750106618,1635-3262827,1634-0,1632-315604704',
'timestamp' => '1200507172',
'event' => '2',
'grade' => '0',
'raw_grade' => '0.75',
'penalty' => '0.1',
'id' => 862673,
),
862716 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '4',
'answer' => '1633-750106618,1635-3262827,1634-3262827,1632-315604704',
'timestamp' => '1200507467',
'event' => '2',
'grade' => '0',
'raw_grade' => '0.75',
'penalty' => '0.1',
'id' => 862716,
),
862740 => (object) array(
'attempt' => '23777',
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '5',
'answer' => '1633-750106618,1635-3262827,1634-3262827,1632-315604704',
'timestamp' => '1200507467',
'event' => '6',
'grade' => '0.75',
'raw_grade' => '0.75',
'penalty' => '0.1',
'id' => 862740,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'deferredfeedback',
'questionid' => 11135,
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => 'Which of the following statements about subject gateways are true, and which are false? {Subject gateways provide links to sites that have been quality checked; Subject gateways offer more variety than search engines; Subject gateways index websites automatically; Subject gateways can provide a more direct route to websites containing academic content} -> {True; False}',
'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
'responsesummary' => 'Subject gateways offer more variety than search engines -> False; Subject gateways can provide a more direct route to websites containing academic content -> True; Subject gateways index websites automatically -> True; Subject gateways provide links to sites that have been quality checked -> True',
'timemodified' => 1200507467,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1200506648,
'userid' => 6584,
'data' => array('_stemorder' => '1633,1635,1634,1632', '_choiceorder' => 'todo - see below'),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1200507025,
'userid' => 6584,
'data' => array('sub0' => 1633, 'sub1' => 1632, 'sub2' => 0, 'sub3' => 1632),
),
2 => (object) array(
'sequencenumber' => 2,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1200507125,
'userid' => 6584,
'data' => array('sub0' => 1633, 'sub1' => 1632, 'sub2' => 0, 'sub3' => 1632),
),
3 => (object) array(
'sequencenumber' => 3,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1200507172,
'userid' => 6584,
'data' => array('sub0' => 1633, 'sub1' => 1632, 'sub2' => 0, 'sub3' => 1632),
),
4 => (object) array(
'sequencenumber' => 4,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1200507467,
'userid' => 6584,
'data' => array('sub0' => 1633, 'sub1' => 1632, 'sub2' => 1632, 'sub3' => 1632),
),
5 => (object) array(
'sequencenumber' => 5,
'state' => 'gradedpartial',
'fraction' => 0.75,
'timecreated' => 1200507467,
'userid' => 6584,
'data' => array('sub0' => 1633, 'sub1' => 1632, 'sub2' => 1632, 'sub3' => 1632, '-finish' => 1),
),
),
);
// This is a random thing, so just set expected to actual:
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
for ($i = 1; $i <= 5; $i++) {
for ($sub = 0; $sub < 5; $sub++) {
if (!array_key_exists('sub' . $sub, $expectedqa->steps[$i]->data) ||
$expectedqa->steps[$i]->data['sub' . $sub] == 0) {
continue;
}
$expectedqa->steps[$i]->data['sub' . $sub] =
$order[$expectedqa->steps[$i]->data['sub' . $sub]] + 1;
}
}
$this->assertEqual($expectedqa, $qa);
}
}

View File

@ -0,0 +1,265 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests of the upgrade to the new Moodle question engine for attempts at
* numerical questions.
*
* @package qtype
* @subpackage numerical
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php');
/**
* Testing the upgrade of numerical question attempts.
*
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_numerical_attempt_upgrader_test extends question_attempt_upgrader_test_base {
public function test_numerical_deferredfeedback_history620() {
$quiz = (object) array(
'id' => '221',
'course' => '187',
'name' => 'Practice CTMA04',
'intro' => 'This is the Practice CTMA04. Your mark for this CTMA <span style="font-style: italic">does not </span>contribute to your continuous assessment mark for B680.<br /><br />This CTMA covers material primarily in Books 10 and 11, however some of the questions may return to material you covered in Books 0 to 9. There are 100 questions in total.<br /><br />It is a function of this testing software that it cannot provide for every possible spelling error that you make. The onus is therefore on you, the student, to ensure that your spelling is correct. ',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
'showblocks' => '1',
'timeopen' => '1178492400',
'timeclose' => '1193875200',
'preferredbehaviour' => 'deferredfeedback',
'attempts' => '0',
'attemptonlast' => '0',
'grademethod' => '1',
'decimalpoints' => '2',
'review' => '71727591',
'questionsperpage' => '1',
'shufflequestions' => '0',
'shuffleanswers' => '0',
'questions' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0',
'sumgrades' => '100',
'grade' => '100',
'timecreated' => '0',
'timemodified' => '1195232889',
'password' => '',
'subnet' => '',
'popup' => '0',
'delay1' => '0',
'delay2' => '0',
'timelimit' => '0',
);
$attempt = (object) array(
'id' => '4034',
'uniqueid' => '4034',
'quiz' => '221',
'userid' => '405',
'attempt' => '1',
'sumgrades' => '59',
'timestart' => '1178564323',
'timefinish' => '1178575685',
'timemodified' => '1178571037',
'layout' => '4184,0,4185,0,4154,0,4186,0,4187,0,4188,0,4189,0,4190,0,4162,0,4191,0,4192,0,4193,0,4254,0,4195,0,4196,0,4163,0,4197,0,4198,0,4199,0,4164,0,4200,0,4165,0,4201,0,4202,0,4166,0,4203,0,4204,0,4205,0,4167,0,4155,0,4168,0,4206,0,4207,0,4208,0,4209,0,4210,0,4211,0,4212,0,4213,0,4214,0,4156,0,4215,0,4216,0,4217,0,4169,0,4170,0,4157,0,4218,0,4219,0,4220,0,4171,0,4221,0,4172,0,4222,0,4223,0,4224,0,4225,0,4226,0,4227,0,4228,0,4173,0,4229,0,4230,0,4231,0,4232,0,4174,0,4233,0,4234,0,4235,0,4236,0,4237,0,4238,0,4239,0,4240,0,4241,0,4242,0,4158,0,4243,0,4244,0,4245,0,4246,0,4159,0,4175,0,4247,0,4176,0,4248,0,4177,0,4160,0,4249,0,4178,0,4250,0,4161,0,4251,0,4179,0,4252,0,4180,0,4181,0,4182,0,4253,0,4183,0',
'preview' => '0',
'needsupgradetonewqe' => '1',
);
$question = (object) array(
'id' => '4165',
'category' => '204',
'parent' => '0',
'name' => '4ccP22 Book 11 Electronic Activity 6.3 Screen F2 NPV calcn(7)',
'questiontext' => 'Calculate your answer to the nearest WHOLE £ and enter it in the blank space provided.
<p>[Note: Please <b><i>DO NOT</i></b> enter commas, spaces or £ signs within the number you enter.] </p>
<p>The cash flows of a project are set out below: </p>
<p>
<table width="500" border="1"><tbody>
<tr>
<th valign="top" width="50%" halign="CENTER">year
</th>
<th valign="top" width="50%">£
</th>
</tr>
<tr>
<td>Year 0
</td>
<td>(28,000)
</td>
</tr>
<tr>
<td>Year 1
</td>
<td>18,000
</td>
</tr>
<tr>
<td>Year 2
</td>
<td>16,000
</td>
</tr></tbody>
</table></p>
<p>Using the Table in Book 11, what is the project\'s net present value using a discount rate of 10%? </p>
<p>If it is negative, put a minus sign before the number you enter. </p>
<p>£ </p>',
'questiontextformat' => '1',
'defaultmark' => '1',
'penalty' => '1',
'qtype' => 'numerical',
'length' => '1',
'stamp' => 'learn.open.ac.uk+070417143727+5hOqJ8',
'version' => 'learn.open.ac.uk+070417154843+o0iHPi',
'hidden' => '0',
'generalfeedback' => '',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
'createdby' => NULL,
'modifiedby' => NULL,
'unlimited' => NULL,
'maxmark' => '1',
'options' => (object) array(
'answers' => array(
12729 => (object) array(
'question' => '4165',
'answer' => '1586',
'fraction' => '1',
'feedback' => 'Yes, the correct answer is £1,586. Well done!
<p>Note to the answer:<br />£(18,000 x 0.9091) + (£16,000 x 0.8264) - £28,000 = £1,586.2 (the factors are found in the Table 1 of the Appendix to Book 11) </p>
<p>Book 11 Electronic Activity 6.3 Screen F2 </p>',
'tolerance' => '0',
'id' => 12729,
),
12730 => (object) array(
'question' => '4165',
'answer' => '*',
'fraction' => '0',
'feedback' => 'The correct answer is £1,586.
<p>Note to the answer:<br />£(18,000 x 0.9091) + (£16,000 x 0.8264) - £28,000 = £1,586.2 (the factors are found in the Table 1 of the Appendix to Book 11) </p>
<p>Book 11 Electronic Activity 6.3 Screen F2 </p>',
'tolerance' => '0',
'id' => 12730,
),
),
'units' => array(
),
),
'hints' => false,
);
$qsession = (object) array(
'id' => '39882',
'attemptid' => '4034',
'questionid' => '4165',
'newest' => '92971',
'newgraded' => '92971',
'sumpenalty' => '1',
'manualcomment' => '',
'manualcommentformat' => '1',
'flagged' => '1',
);
$qstates = array(
92694 => (object) array(
'attempt' => '4034',
'question' => '4165',
'originalquestion' => '0',
'seq_number' => '0',
'answer' => '',
'timestamp' => '1178564323',
'event' => '0',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '0',
'id' => 92694,
),
92764 => (object) array(
'attempt' => '4034',
'question' => '4165',
'originalquestion' => '0',
'seq_number' => '1',
'answer' => '17520',
'timestamp' => '1178567143',
'event' => '2',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '1',
'id' => 92764,
),
92971 => (object) array(
'attempt' => '4034',
'question' => '4165',
'originalquestion' => '0',
'seq_number' => '2',
'answer' => '17520',
'timestamp' => '1178567143',
'event' => '6',
'grade' => '0',
'raw_grade' => '0',
'penalty' => '1',
'id' => 92971,
),
);
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
$expectedqa = (object) array(
'behaviour' => 'deferredfeedback',
'questionid' => 4165,
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
'questionsummary' => "Calculate your answer to the nearest WHOLE £ and enter it in the blank space provided. \n\n[Note: Please _DO NOT_ enter commas, spaces or £ signs within the number you enter.] \n\nThe cash flows of a project are set out below: \n\n \t\tYear 0 \n \t\t(28,000) \n\n \t\tYear 1 \n \t\t18,000 \n\n \t\tYear 2 \n \t\t16,000 \n\nUsing the Table in Book 11, what is the project's net present value using a discount rate of 10%? \n\nIf it is negative, put a minus sign before the number you enter. \n\n£",
'rightanswer' => '1586',
'responsesummary' => '17520',
'timemodified' => 1178567143,
'steps' => array(
0 => (object) array(
'sequencenumber' => 0,
'state' => 'todo',
'fraction' => null,
'timecreated' => 1178564323,
'userid' => 405,
'data' => array('_separators' => '.$,'),
),
1 => (object) array(
'sequencenumber' => 1,
'state' => 'complete',
'fraction' => null,
'timecreated' => 1178567143,
'userid' => 405,
'data' => array('answer' => 17520),
),
2 => (object) array(
'sequencenumber' => 2,
'state' => 'gradedwrong',
'fraction' => 0,
'timecreated' => 1178567143,
'userid' => 405,
'data' => array('answer' => 17520, '-finish' => 1),
),
),
);
$this->assertEqual($expectedqa, $qa);
}
}