|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00028 defined('MOODLE_INTERNAL') || die(); 00029 00030 require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php'); 00031 00032 00039 class qtype_description_attempt_upgrader_test extends question_attempt_upgrader_test_base { 00040 00041 public function test_description_deferredfeedback_history80() { 00042 $quiz = (object) array( 00043 'id' => '278', 00044 'course' => '2950', 00045 'name' => 'test quiz 1', 00046 'intro' => 'my demonstration quiz ', 00047 'introformat' => FORMAT_HTML, 00048 'questiondecimalpoints' => '-1', 00049 'showuserpicture' => '1', 00050 'showblocks' => '1', 00051 'timeopen' => '0', 00052 'timeclose' => '0', 00053 'preferredbehaviour' => 'deferredfeedback', 00054 'attempts' => '0', 00055 'attemptonlast' => '0', 00056 'grademethod' => '1', 00057 'decimalpoints' => '2', 00058 'review' => '71727591', 00059 'questionsperpage' => '1', 00060 'shufflequestions' => '0', 00061 'shuffleanswers' => '1', 00062 'questions' => '4940,0,5043,0,4945,0,4942,0,5566,0', 00063 'sumgrades' => '5', 00064 'grade' => '10', 00065 'timecreated' => '0', 00066 'timemodified' => '1178101987', 00067 'password' => '', 00068 'subnet' => '', 00069 'popup' => '0', 00070 'delay1' => '0', 00071 'delay2' => '0', 00072 'timelimit' => '0', 00073 ); 00074 $attempt = (object) array( 00075 'id' => '6802', 00076 'uniqueid' => '6802', 00077 'quiz' => '278', 00078 'userid' => '13', 00079 'attempt' => '1', 00080 'sumgrades' => '2.33333', 00081 'timestart' => '1185289572', 00082 'timefinish' => '1185289637', 00083 'timemodified' => '1185289590', 00084 'layout' => '4940,0,5043,0,4945,0,4942,0,5566,0', 00085 'preview' => '1', 00086 'needsupgradetonewqe' => '1', 00087 ); 00088 $question = (object) array( 00089 'id' => '4940', 00090 'category' => '247', 00091 'parent' => '0', 00092 'name' => 'Northampton Gallery Case Study', 00093 '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.', 00094 'questiontextformat' => '1', 00095 'defaultmark' => '0', 00096 'penalty' => '0', 00097 'qtype' => 'description', 00098 'length' => '1', 00099 'stamp' => 'learn.open.ac.uk+070501114616+rtsfKk', 00100 'version' => 'learn.open.ac.uk+070501114616+ZY94d5', 00101 'hidden' => '0', 00102 'generalfeedback' => '', 00103 'generalfeedbackformat' => '1', 00104 'timecreated' => '0', 00105 'timemodified' => '0', 00106 'createdby' => null, 00107 'modifiedby' => null, 00108 'unlimited' => null, 00109 'maxmark' => '1', 00110 ); 00111 $qsession = (object) array( 00112 'id' => '130459', 00113 'attemptid' => '6802', 00114 'questionid' => '4940', 00115 'newest' => '297740', 00116 'newgraded' => '297730', 00117 'sumpenalty' => '0', 00118 'manualcomment' => '', 00119 'manualcommentformat' => '1', 00120 'flagged' => '1', 00121 ); 00122 $qstates = array( 00123 297730 => (object) array( 00124 'attempt' => '6802', 00125 'question' => '4940', 00126 'originalquestion' => '0', 00127 'seq_number' => '0', 00128 'answer' => '', 00129 'timestamp' => '1185289572', 00130 'event' => '0', 00131 'grade' => '0', 00132 'raw_grade' => '0', 00133 'penalty' => '0', 00134 'id' => 297730, 00135 ), 00136 297740 => (object) array( 00137 'attempt' => '6802', 00138 'question' => '4940', 00139 'originalquestion' => '0', 00140 'seq_number' => '1', 00141 'answer' => '', 00142 'timestamp' => '1185289572', 00143 'event' => '8', 00144 'grade' => '0', 00145 'raw_grade' => '0', 00146 'penalty' => '0', 00147 'id' => 297740, 00148 ), 00149 ); 00150 00151 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00152 00153 $expectedqa = (object) array( 00154 'behaviour' => 'informationitem', 00155 'questionid' => 4940, 00156 'variant' => 1, 00157 'maxmark' => 1, 00158 'minfraction' => 0, 00159 'flagged' => 0, 00160 '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.', 00161 'rightanswer' => '', 00162 'responsesummary' => '', 00163 'timemodified' => 1185289572, 00164 'steps' => array( 00165 0 => (object) array( 00166 'sequencenumber' => 0, 00167 'state' => 'todo', 00168 'fraction' => null, 00169 'timecreated' => 1185289572, 00170 'userid' => 13, 00171 'data' => array(), 00172 ), 00173 1 => (object) array( 00174 'sequencenumber' => 1, 00175 'state' => 'finished', 00176 'fraction' => null, 00177 'timecreated' => 1185289572, 00178 'userid' => 13, 00179 'data' => array('-finish' => 1), 00180 ), 00181 ), 00182 ); 00183 00184 $this->compare_qas($expectedqa, $qa); 00185 } 00186 00187 public function test_description_deferredfeedback_history70() { 00188 $quiz = (object) array( 00189 'id' => '442', 00190 'course' => '2591', 00191 'name' => 'Needs Analysis (online version)', 00192 '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 />', 00193 'introformat' => FORMAT_HTML, 00194 'questiondecimalpoints' => '-1', 00195 'showuserpicture' => '1', 00196 'showblocks' => '1', 00197 'timeopen' => '0', 00198 'timeclose' => '0', 00199 'preferredbehaviour' => 'deferredfeedback', 00200 'attempts' => '1', 00201 'attemptonlast' => '0', 00202 'grademethod' => '1', 00203 'decimalpoints' => '2', 00204 'review' => '71719269', 00205 'questionsperpage' => '1', 00206 'shufflequestions' => '0', 00207 'shuffleanswers' => '0', 00208 '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', 00209 'sumgrades' => '0', 00210 'grade' => '10', 00211 'timecreated' => '0', 00212 'timemodified' => '1202212400', 00213 'password' => '', 00214 'subnet' => '', 00215 'popup' => '0', 00216 'delay1' => '0', 00217 'delay2' => '0', 00218 'timelimit' => '0', 00219 ); 00220 $attempt = (object) array( 00221 'id' => '11230', 00222 'uniqueid' => '11230', 00223 'quiz' => '442', 00224 'userid' => '193184', 00225 'attempt' => '1', 00226 'sumgrades' => '0', 00227 'timestart' => '1192648793', 00228 'timefinish' => '1192742609', 00229 'timemodified' => '1192742300', 00230 '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', 00231 'preview' => '0', 00232 'needsupgradetonewqe' => '1', 00233 ); 00234 $question = (object) array( 00235 'id' => '8492', 00236 'category' => '131', 00237 'parent' => '0', 00238 'name' => 'Personal and Professional Information', 00239 '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.', 00240 'questiontextformat' => '1', 00241 'defaultmark' => '0', 00242 'penalty' => '0', 00243 'qtype' => 'description', 00244 'length' => '0', 00245 'stamp' => 'learn.open.ac.uk+070808083925+qTmPpB', 00246 'version' => 'learn.open.ac.uk+070907143809+3ltY7I', 00247 'hidden' => '0', 00248 'generalfeedback' => '', 00249 'generalfeedbackformat' => '1', 00250 'timecreated' => '0', 00251 'timemodified' => '0', 00252 'createdby' => null, 00253 'modifiedby' => null, 00254 'unlimited' => null, 00255 'maxmark' => '0', 00256 ); 00257 $qsession = (object) array( 00258 'id' => '206424', 00259 'attemptid' => '11230', 00260 'questionid' => '8492', 00261 'newest' => '480877', 00262 'newgraded' => '476039', 00263 'sumpenalty' => '0', 00264 'manualcomment' => '', 00265 'manualcommentformat' => '1', 00266 'flagged' => '1', 00267 ); 00268 $qstates = array( 00269 476039 => (object) array( 00270 'attempt' => '11230', 00271 'question' => '8492', 00272 'originalquestion' => '0', 00273 'seq_number' => '0', 00274 'answer' => '', 00275 'timestamp' => '1192648793', 00276 'event' => '0', 00277 'grade' => '0', 00278 'raw_grade' => '0', 00279 'penalty' => '0', 00280 'id' => 476039, 00281 ), 00282 480877 => (object) array( 00283 'attempt' => '11230', 00284 'question' => '8492', 00285 'originalquestion' => '0', 00286 'seq_number' => '1', 00287 'answer' => '', 00288 'timestamp' => '1192648793', 00289 'event' => '7', 00290 'grade' => '0', 00291 'raw_grade' => '0', 00292 'penalty' => '0', 00293 'id' => 480877, 00294 ), 00295 ); 00296 00297 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00298 00299 $expectedqa = (object) array( 00300 'behaviour' => 'informationitem', 00301 'questionid' => 8492, 00302 'variant' => 1, 00303 'maxmark' => 0, 00304 'minfraction' => 0, 00305 'flagged' => 0, 00306 'questionsummary' => "PERSONAL AND PROFESSIONAL INFORMATION\n\nHere we want you to enter personal information and outline your professional qualifications and experience to date.", 00307 'rightanswer' => '', 00308 'responsesummary' => '', 00309 'timemodified' => 1192648793, 00310 'steps' => array( 00311 0 => (object) array( 00312 'sequencenumber' => 0, 00313 'state' => 'todo', 00314 'fraction' => null, 00315 'timecreated' => 1192648793, 00316 'userid' => 193184, 00317 'data' => array(), 00318 ), 00319 1 => (object) array( 00320 'sequencenumber' => 1, 00321 'state' => 'finished', 00322 'fraction' => null, 00323 'timecreated' => 1192648793, 00324 'userid' => 193184, 00325 'data' => array('-finish' => 1), 00326 ), 00327 ), 00328 ); 00329 00330 $this->compare_qas($expectedqa, $qa); 00331 } 00332 00333 public function test_description_deferredfeedback_history0() { 00334 $quiz = (object) array( 00335 'id' => '466', 00336 'course' => '3464', 00337 'name' => 'Music CPD Needs Analysis', 00338 '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 /> 00339 <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 /> 00340 <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 /> 00341 <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 />', 00342 'introformat' => FORMAT_HTML, 00343 'questiondecimalpoints' => '-1', 00344 'showuserpicture' => '1', 00345 'showblocks' => '1', 00346 'timeopen' => '0', 00347 'timeclose' => '0', 00348 'preferredbehaviour' => 'deferredfeedback', 00349 'attempts' => '1', 00350 'attemptonlast' => '0', 00351 'grademethod' => '1', 00352 'decimalpoints' => '2', 00353 'review' => '71719269', 00354 'questionsperpage' => '1', 00355 'shufflequestions' => '0', 00356 'shuffleanswers' => '0', 00357 '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', 00358 'sumgrades' => '0', 00359 'grade' => '10', 00360 'timecreated' => '0', 00361 'timemodified' => '1184685800', 00362 'password' => '', 00363 'subnet' => '', 00364 'popup' => '0', 00365 'delay1' => '0', 00366 'delay2' => '0', 00367 'timelimit' => '0', 00368 ); 00369 $attempt = (object) array( 00370 'id' => '7401', 00371 'uniqueid' => '7401', 00372 'quiz' => '466', 00373 'userid' => '24474', 00374 'attempt' => '1', 00375 'sumgrades' => '0', 00376 'timestart' => '1187168654', 00377 'timefinish' => '0', 00378 'timemodified' => '1187168769', 00379 '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', 00380 'preview' => '1', 00381 'needsupgradetonewqe' => '1', 00382 ); 00383 $question = (object) array( 00384 'id' => '8719', 00385 'category' => '427', 00386 'parent' => '0', 00387 'name' => 'Music Teaching and Learning', 00388 '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 />', 00389 'questiontextformat' => '1', 00390 'defaultmark' => '0', 00391 'penalty' => '0', 00392 'qtype' => 'description', 00393 'length' => '0', 00394 'stamp' => 'learn.open.ac.uk+070430145701+r8LVld', 00395 'version' => 'learn.open.ac.uk+070430145834+FxIAjw', 00396 'hidden' => '0', 00397 'generalfeedback' => '', 00398 'generalfeedbackformat' => '1', 00399 'timecreated' => '0', 00400 'timemodified' => '0', 00401 'createdby' => null, 00402 'modifiedby' => null, 00403 'unlimited' => null, 00404 'maxmark' => '0', 00405 ); 00406 $qsession = (object) array( 00407 'id' => '157658', 00408 'attemptid' => '7401', 00409 'questionid' => '8719', 00410 'newest' => '361166', 00411 'newgraded' => '361166', 00412 'sumpenalty' => '0', 00413 'manualcomment' => '', 00414 'manualcommentformat' => '1', 00415 'flagged' => '1', 00416 ); 00417 $qstates = array( 00418 361166 => (object) array( 00419 'attempt' => '7401', 00420 'question' => '8719', 00421 'originalquestion' => '0', 00422 'seq_number' => '0', 00423 'answer' => '', 00424 'timestamp' => '1187168654', 00425 'event' => '0', 00426 'grade' => '0', 00427 'raw_grade' => '0', 00428 'penalty' => '0', 00429 'id' => 361166, 00430 ), 00431 ); 00432 00433 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 00434 00435 $expectedqa = (object) array( 00436 'behaviour' => 'informationitem', 00437 'questionid' => 8719, 00438 'variant' => 1, 00439 'maxmark' => 0, 00440 'minfraction' => 0, 00441 'flagged' => 0, 00442 '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’.", 00443 'rightanswer' => '', 00444 'responsesummary' => '', 00445 'timemodified' => 1187168654, 00446 'steps' => array( 00447 0 => (object) array( 00448 'sequencenumber' => 0, 00449 'state' => 'todo', 00450 'fraction' => null, 00451 'timecreated' => 1187168654, 00452 'userid' => 24474, 00453 'data' => array(), 00454 ), 00455 ), 00456 ); 00457 00458 $this->compare_qas($expectedqa, $qa); 00459 } 00460 }