1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Tests of the upgrade to the new Moodle question engine for attempts at 19 * description questions. 20 * 21 * @package qtype 22 * @subpackage description 23 * @copyright 2009 The Open University 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 global $CFG; 31 require_once($CFG->dirroot . '/question/engine/upgrade/tests/helper.php'); 32 33 34 /** 35 * Testing the upgrade of description question attempts. 36 * 37 * @copyright 2009 The Open University 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class qtype_description_attempt_upgrader_test extends question_attempt_upgrader_test_base { 41 42 public function test_description_deferredfeedback_history80() { 43 $quiz = (object) array( 44 'id' => '278', 45 'course' => '2950', 46 'name' => 'test quiz 1', 47 'intro' => 'my demonstration quiz ', 48 'introformat' => FORMAT_HTML, 49 'questiondecimalpoints' => '-1', 50 'showuserpicture' => '1', 51 'showblocks' => '1', 52 'timeopen' => '0', 53 'timeclose' => '0', 54 'preferredbehaviour' => 'deferredfeedback', 55 'attempts' => '0', 56 'attemptonlast' => '0', 57 'grademethod' => '1', 58 'decimalpoints' => '2', 59 'review' => '71727591', 60 'questionsperpage' => '1', 61 'shufflequestions' => '0', 62 'shuffleanswers' => '1', 63 'sumgrades' => '5', 64 'grade' => '10', 65 'timecreated' => '0', 66 'timemodified' => '1178101987', 67 'password' => '', 68 'subnet' => '', 69 'popup' => '0', 70 'delay1' => '0', 71 'delay2' => '0', 72 'timelimit' => '0', 73 ); 74 $attempt = (object) array( 75 'id' => '6802', 76 'uniqueid' => '6802', 77 'quiz' => '278', 78 'userid' => '13', 79 'attempt' => '1', 80 'sumgrades' => '2.33333', 81 'timestart' => '1185289572', 82 'timefinish' => '1185289637', 83 'timemodified' => '1185289590', 84 'layout' => '4940,0,5043,0,4945,0,4942,0,5566,0', 85 'preview' => '1', 86 ); 87 $question = (object) array( 88 'id' => '4940', 89 'category' => '247', 90 'parent' => '0', 91 'name' => 'Northampton Gallery Case Study', 92 '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.', 93 'questiontextformat' => '1', 94 'defaultmark' => '0', 95 'penalty' => '0', 96 'qtype' => 'description', 97 'length' => '1', 98 'stamp' => 'learn.open.ac.uk+070501114616+rtsfKk', 99 'version' => 'learn.open.ac.uk+070501114616+ZY94d5', 100 'hidden' => '0', 101 'generalfeedback' => '', 102 'generalfeedbackformat' => '1', 103 'timecreated' => '0', 104 'timemodified' => '0', 105 'createdby' => null, 106 'modifiedby' => null, 107 'unlimited' => null, 108 'maxmark' => '1', 109 ); 110 $qsession = (object) array( 111 'id' => '130459', 112 'attemptid' => '6802', 113 'questionid' => '4940', 114 'newest' => '297740', 115 'newgraded' => '297730', 116 'sumpenalty' => '0', 117 'manualcomment' => '', 118 'manualcommentformat' => '1', 119 'flagged' => '1', 120 ); 121 $qstates = array( 122 297730 => (object) array( 123 'attempt' => '6802', 124 'question' => '4940', 125 'originalquestion' => '0', 126 'seq_number' => '0', 127 'answer' => '', 128 'timestamp' => '1185289572', 129 'event' => '0', 130 'grade' => '0', 131 'raw_grade' => '0', 132 'penalty' => '0', 133 'id' => 297730, 134 ), 135 297740 => (object) array( 136 'attempt' => '6802', 137 'question' => '4940', 138 'originalquestion' => '0', 139 'seq_number' => '1', 140 'answer' => '', 141 'timestamp' => '1185289572', 142 'event' => '8', 143 'grade' => '0', 144 'raw_grade' => '0', 145 'penalty' => '0', 146 'id' => 297740, 147 ), 148 ); 149 150 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 151 152 $expectedqa = (object) array( 153 'behaviour' => 'informationitem', 154 'questionid' => 4940, 155 'variant' => 1, 156 'maxmark' => 1, 157 'minfraction' => 0, 158 'maxfraction' => 1, 159 'flagged' => 0, 160 '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.', 161 'rightanswer' => '', 162 'responsesummary' => '', 163 'timemodified' => 1185289572, 164 'steps' => array( 165 0 => (object) array( 166 'sequencenumber' => 0, 167 'state' => 'todo', 168 'fraction' => null, 169 'timecreated' => 1185289572, 170 'userid' => 13, 171 'data' => array(), 172 ), 173 1 => (object) array( 174 'sequencenumber' => 1, 175 'state' => 'finished', 176 'fraction' => null, 177 'timecreated' => 1185289572, 178 'userid' => 13, 179 'data' => array('-finish' => 1), 180 ), 181 ), 182 ); 183 184 $this->compare_qas($expectedqa, $qa); 185 } 186 187 public function test_description_deferredfeedback_history70() { 188 $quiz = (object) array( 189 'id' => '442', 190 'course' => '2591', 191 'name' => 'Needs Analysis (online version)', 192 '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 />', 193 'introformat' => FORMAT_HTML, 194 'questiondecimalpoints' => '-1', 195 'showuserpicture' => '1', 196 'showblocks' => '1', 197 'timeopen' => '0', 198 'timeclose' => '0', 199 'preferredbehaviour' => 'deferredfeedback', 200 'attempts' => '1', 201 'attemptonlast' => '0', 202 'grademethod' => '1', 203 'decimalpoints' => '2', 204 'review' => '71719269', 205 'questionsperpage' => '1', 206 'shufflequestions' => '0', 207 'shuffleanswers' => '0', 208 'sumgrades' => '0', 209 'grade' => '10', 210 'timecreated' => '0', 211 'timemodified' => '1202212400', 212 'password' => '', 213 'subnet' => '', 214 'popup' => '0', 215 'delay1' => '0', 216 'delay2' => '0', 217 'timelimit' => '0', 218 ); 219 $attempt = (object) array( 220 'id' => '11230', 221 'uniqueid' => '11230', 222 'quiz' => '442', 223 'userid' => '193184', 224 'attempt' => '1', 225 'sumgrades' => '0', 226 'timestart' => '1192648793', 227 'timefinish' => '1192742609', 228 'timemodified' => '1192742300', 229 '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', 230 'preview' => '0', 231 ); 232 $question = (object) array( 233 'id' => '8492', 234 'category' => '131', 235 'parent' => '0', 236 'name' => 'Personal and Professional Information', 237 '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.', 238 'questiontextformat' => '1', 239 'defaultmark' => '0', 240 'penalty' => '0', 241 'qtype' => 'description', 242 'length' => '0', 243 'stamp' => 'learn.open.ac.uk+070808083925+qTmPpB', 244 'version' => 'learn.open.ac.uk+070907143809+3ltY7I', 245 'hidden' => '0', 246 'generalfeedback' => '', 247 'generalfeedbackformat' => '1', 248 'timecreated' => '0', 249 'timemodified' => '0', 250 'createdby' => null, 251 'modifiedby' => null, 252 'unlimited' => null, 253 'maxmark' => '0', 254 ); 255 $qsession = (object) array( 256 'id' => '206424', 257 'attemptid' => '11230', 258 'questionid' => '8492', 259 'newest' => '480877', 260 'newgraded' => '476039', 261 'sumpenalty' => '0', 262 'manualcomment' => '', 263 'manualcommentformat' => '1', 264 'flagged' => '1', 265 ); 266 $qstates = array( 267 476039 => (object) array( 268 'attempt' => '11230', 269 'question' => '8492', 270 'originalquestion' => '0', 271 'seq_number' => '0', 272 'answer' => '', 273 'timestamp' => '1192648793', 274 'event' => '0', 275 'grade' => '0', 276 'raw_grade' => '0', 277 'penalty' => '0', 278 'id' => 476039, 279 ), 280 480877 => (object) array( 281 'attempt' => '11230', 282 'question' => '8492', 283 'originalquestion' => '0', 284 'seq_number' => '1', 285 'answer' => '', 286 'timestamp' => '1192648793', 287 'event' => '7', 288 'grade' => '0', 289 'raw_grade' => '0', 290 'penalty' => '0', 291 'id' => 480877, 292 ), 293 ); 294 295 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 296 297 $expectedqa = (object) array( 298 'behaviour' => 'informationitem', 299 'questionid' => 8492, 300 'variant' => 1, 301 'maxmark' => 0, 302 'minfraction' => 0, 303 'maxfraction' => 1, 304 'flagged' => 0, 305 'questionsummary' => "PERSONAL AND PROFESSIONAL INFORMATION\n\nHere we want you to enter personal information and outline your professional qualifications and experience to date.", 306 'rightanswer' => '', 307 'responsesummary' => '', 308 'timemodified' => 1192648793, 309 'steps' => array( 310 0 => (object) array( 311 'sequencenumber' => 0, 312 'state' => 'todo', 313 'fraction' => null, 314 'timecreated' => 1192648793, 315 'userid' => 193184, 316 'data' => array(), 317 ), 318 1 => (object) array( 319 'sequencenumber' => 1, 320 'state' => 'finished', 321 'fraction' => null, 322 'timecreated' => 1192648793, 323 'userid' => 193184, 324 'data' => array('-finish' => 1), 325 ), 326 ), 327 ); 328 329 $this->compare_qas($expectedqa, $qa); 330 } 331 332 public function test_description_deferredfeedback_history0() { 333 $quiz = (object) array( 334 'id' => '466', 335 'course' => '3464', 336 'name' => 'Music CPD Needs Analysis', 337 '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 /> 338 <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 /> 339 <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 /> 340 <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 />', 341 'introformat' => FORMAT_HTML, 342 'questiondecimalpoints' => '-1', 343 'showuserpicture' => '1', 344 'showblocks' => '1', 345 'timeopen' => '0', 346 'timeclose' => '0', 347 'preferredbehaviour' => 'deferredfeedback', 348 'attempts' => '1', 349 'attemptonlast' => '0', 350 'grademethod' => '1', 351 'decimalpoints' => '2', 352 'review' => '71719269', 353 'questionsperpage' => '1', 354 'shufflequestions' => '0', 355 'shuffleanswers' => '0', 356 'sumgrades' => '0', 357 'grade' => '10', 358 'timecreated' => '0', 359 'timemodified' => '1184685800', 360 'password' => '', 361 'subnet' => '', 362 'popup' => '0', 363 'delay1' => '0', 364 'delay2' => '0', 365 'timelimit' => '0', 366 ); 367 $attempt = (object) array( 368 'id' => '7401', 369 'uniqueid' => '7401', 370 'quiz' => '466', 371 'userid' => '24474', 372 'attempt' => '1', 373 'sumgrades' => '0', 374 'timestart' => '1187168654', 375 'timefinish' => '0', 376 'timemodified' => '1187168769', 377 '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', 378 'preview' => '1', 379 ); 380 $question = (object) array( 381 'id' => '8719', 382 'category' => '427', 383 'parent' => '0', 384 'name' => 'Music Teaching and Learning', 385 '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 />', 386 'questiontextformat' => '1', 387 'defaultmark' => '0', 388 'penalty' => '0', 389 'qtype' => 'description', 390 'length' => '0', 391 'stamp' => 'learn.open.ac.uk+070430145701+r8LVld', 392 'version' => 'learn.open.ac.uk+070430145834+FxIAjw', 393 'hidden' => '0', 394 'generalfeedback' => '', 395 'generalfeedbackformat' => '1', 396 'timecreated' => '0', 397 'timemodified' => '0', 398 'createdby' => null, 399 'modifiedby' => null, 400 'unlimited' => null, 401 'maxmark' => '0', 402 ); 403 $qsession = (object) array( 404 'id' => '157658', 405 'attemptid' => '7401', 406 'questionid' => '8719', 407 'newest' => '361166', 408 'newgraded' => '361166', 409 'sumpenalty' => '0', 410 'manualcomment' => '', 411 'manualcommentformat' => '1', 412 'flagged' => '1', 413 ); 414 $qstates = array( 415 361166 => (object) array( 416 'attempt' => '7401', 417 'question' => '8719', 418 'originalquestion' => '0', 419 'seq_number' => '0', 420 'answer' => '', 421 'timestamp' => '1187168654', 422 'event' => '0', 423 'grade' => '0', 424 'raw_grade' => '0', 425 'penalty' => '0', 426 'id' => 361166, 427 ), 428 ); 429 430 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 431 432 $expectedqa = (object) array( 433 'behaviour' => 'informationitem', 434 'questionid' => 8719, 435 'variant' => 1, 436 'maxmark' => 0, 437 'minfraction' => 0, 438 'maxfraction' => 1, 439 'flagged' => 0, 440 '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’.", 441 'rightanswer' => '', 442 'responsesummary' => '', 443 'timemodified' => 1187168654, 444 'steps' => array( 445 0 => (object) array( 446 'sequencenumber' => 0, 447 'state' => 'todo', 448 'fraction' => null, 449 'timecreated' => 1187168654, 450 'userid' => 24474, 451 'data' => array(), 452 ), 453 ), 454 ); 455 456 $this->compare_qas($expectedqa, $qa); 457 } 458 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body