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 namespace qtype_calculatedmulti; 18 19 defined('MOODLE_INTERNAL') || die(); 20 21 global $CFG; 22 require_once($CFG->dirroot . '/question/engine/upgrade/tests/helper.php'); 23 24 25 /** 26 * Testing the upgrade of calculated multiple-choice question attempts. 27 * 28 * @package qtype_calculatedmulti 29 * @copyright 2011 The Open University 30 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 31 */ 32 class upgrade_old_attempt_data_test extends \question_attempt_upgrader_test_base { 33 public function test_calculatedmulti_adaptive_qsession96() { 34 $quiz = (object) array( 35 'id' => '4', 36 'course' => '2', 37 'name' => 'Calculated quiz', 38 'intro' => '', 39 'introformat' => '1', 40 'timeopen' => '0', 41 'timeclose' => '0', 42 'attempts' => '0', 43 'attemptonlast' => '0', 44 'grademethod' => '1', 45 'decimalpoints' => '2', 46 'questiondecimalpoints' => '-1', 47 'questionsperpage' => '1', 48 'shufflequestions' => '0', 49 'shuffleanswers' => '1', 50 'sumgrades' => '3.00000', 51 'grade' => '10.00000', 52 'timecreated' => '0', 53 'timemodified' => '1305648351', 54 'timelimit' => '0', 55 'password' => '', 56 'subnet' => '', 57 'popup' => '0', 58 'delay1' => '0', 59 'delay2' => '0', 60 'showuserpicture' => '0', 61 'showblocks' => '0', 62 'preferredbehaviour' => 'adaptive', 63 'reviewattempt' => '69888', 64 'reviewcorrectness' => '69888', 65 'reviewmarks' => '69888', 66 'reviewspecificfeedback' => '69888', 67 'reviewgeneralfeedback' => '69888', 68 'reviewrightanswer' => '69888', 69 'reviewoverallfeedback' => '4352', 70 ); 71 $attempt = (object) array( 72 'id' => '13', 73 'uniqueid' => '13', 74 'quiz' => '4', 75 'userid' => '4', 76 'attempt' => '1', 77 'sumgrades' => '0.00000', 78 'timestart' => '1305830650', 79 'timefinish' => '1305830656', 80 'timemodified' => '1305830656', 81 'layout' => '16,0,17,0,18,0', 82 'preview' => '0', 83 ); 84 $question = (object) array( 85 'id' => '17', 86 'category' => '2', 87 'parent' => '0', 88 'name' => 'Calculated multiple-choice', 89 'questiontext' => '<p>What is {a} + {b}?</p>', 90 'questiontextformat' => '1', 91 'generalfeedback' => '', 92 'generalfeedbackformat' => '1', 93 'defaultmark' => '1.0000000', 94 'penalty' => '0.1', 95 'qtype' => 'calculatedmulti', 96 'length' => '1', 97 'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv', 98 'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ', 99 'hidden' => '0', 100 'timecreated' => '1305830480', 101 'timemodified' => '1305830480', 102 'createdby' => '2', 103 'modifiedby' => '2', 104 'maxmark' => '1.0000000', 105 'options' => (object) array( 106 'id' => '1', 107 'question' => '17', 108 'synchronize' => '0', 109 'single' => '1', 110 'shuffleanswers' => '1', 111 'correctfeedback' => '', 112 'correctfeedbackformat' => '1', 113 'partiallycorrectfeedback' => '', 114 'partiallycorrectfeedbackformat' => '1', 115 'incorrectfeedback' => '', 116 'incorrectfeedbackformat' => '1', 117 'answernumbering' => 'abc', 118 'shownumcorrect' => '0', 119 'answers' => array( 120 24 => (object) array( 121 'id' => '24', 122 'question' => '17', 123 'answer' => '{={a} - {b}}', 124 'answerformat' => '0', 125 'fraction' => '0.0000000', 126 'feedback' => '', 127 'feedbackformat' => '1', 128 'tolerance' => '0.01', 129 'tolerancetype' => '1', 130 'correctanswerlength' => '2', 131 'correctanswerformat' => '1', 132 ), 133 25 => (object) array( 134 'id' => '25', 135 'question' => '17', 136 'answer' => '{={a} + {b}}', 137 'answerformat' => '0', 138 'fraction' => '1.0000000', 139 'feedback' => '', 140 'feedbackformat' => '1', 141 'tolerance' => '0.01', 142 'tolerancetype' => '1', 143 'correctanswerlength' => '2', 144 'correctanswerformat' => '1', 145 ), 146 26 => (object) array( 147 'id' => '26', 148 'question' => '17', 149 'answer' => '{={a} / {b}}', 150 'answerformat' => '0', 151 'fraction' => '0.0000000', 152 'feedback' => '', 153 'feedbackformat' => '1', 154 'tolerance' => '0.01', 155 'tolerancetype' => '1', 156 'correctanswerlength' => '2', 157 'correctanswerformat' => '1', 158 ), 159 27 => (object) array( 160 'id' => '27', 161 'question' => '17', 162 'answer' => '{={a} * {b}}', 163 'answerformat' => '0', 164 'fraction' => '0.0000000', 165 'feedback' => '', 166 'feedbackformat' => '1', 167 'tolerance' => '0.01', 168 'tolerancetype' => '1', 169 'correctanswerlength' => '2', 170 'correctanswerformat' => '1', 171 ), 172 ), 173 ), 174 'hints' => array( 175 ), 176 ); 177 $qsession = (object) array( 178 'id' => '96', 179 'attemptid' => '13', 180 'questionid' => '17', 181 'newest' => '257', 182 'newgraded' => '257', 183 'sumpenalty' => '0.1000000', 184 'manualcomment' => '', 185 'manualcommentformat' => '1', 186 'flagged' => '0', 187 ); 188 $qstates = array( 189 254 => (object) array( 190 'id' => '254', 191 'attempt' => '13', 192 'question' => '17', 193 'seq_number' => '0', 194 'answer' => 'dataset3-24,26,27,25:', 195 'timestamp' => '1305830650', 196 'event' => '0', 197 'grade' => '0.0000000', 198 'raw_grade' => '0.0000000', 199 'penalty' => '0.0000000', 200 ), 201 257 => (object) array( 202 'id' => '257', 203 'attempt' => '13', 204 'question' => '17', 205 'seq_number' => '1', 206 'answer' => 'dataset3-24,26,27,25:', 207 'timestamp' => '1305830650', 208 'event' => '6', 209 'grade' => '0.0000000', 210 'raw_grade' => '0.0000000', 211 'penalty' => '0.1000000', 212 ), 213 ); 214 $this->loader->put_dataset_in_cache($question->id, 3, array('a' => '4.3', 'b' => '5.4')); 215 216 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 217 218 $expectedqa = (object) array( 219 'behaviour' => 'adaptive', 220 'questionid' => 17, 221 'variant' => 3, 222 'maxmark' => 1.0000000, 223 'minfraction' => 0, 224 'maxfraction' => 1, 225 'flagged' => 0, 226 'questionsummary' => 'What is 4.3 + 5.4?', 227 'rightanswer' => '9.7', 228 'responsesummary' => '', 229 'timemodified' => 1305830650, 230 'steps' => array( 231 0 => (object) array( 232 'sequencenumber' => 0, 233 'state' => 'todo', 234 'fraction' => null, 235 'timecreated' => 1305830650, 236 'userid' => 4, 237 'data' => array('_order' => '24,26,27,25', '_var_a' => '4.3', '_var_b' => '5.4'), 238 ), 239 1 => (object) array( 240 'sequencenumber' => 1, 241 'state' => 'gradedwrong', 242 'fraction' => null, 243 'timecreated' => 1305830650, 244 'userid' => 4, 245 'data' => array('-finish' => 1, '-_try' => 1, '-_rawfraction' => 0), 246 ), 247 ), 248 ); 249 250 $this->compare_qas($expectedqa, $qa); 251 } 252 253 public function test_calculatedmulti_adaptive_qsession99() { 254 $quiz = (object) array( 255 'id' => '4', 256 'course' => '2', 257 'name' => 'Calculated quiz', 258 'intro' => '', 259 'introformat' => '1', 260 'timeopen' => '0', 261 'timeclose' => '0', 262 'attempts' => '0', 263 'attemptonlast' => '0', 264 'grademethod' => '1', 265 'decimalpoints' => '2', 266 'questiondecimalpoints' => '-1', 267 'questionsperpage' => '1', 268 'shufflequestions' => '0', 269 'shuffleanswers' => '1', 270 'sumgrades' => '3.00000', 271 'grade' => '10.00000', 272 'timecreated' => '0', 273 'timemodified' => '1305648351', 274 'timelimit' => '0', 275 'password' => '', 276 'subnet' => '', 277 'popup' => '0', 278 'delay1' => '0', 279 'delay2' => '0', 280 'showuserpicture' => '0', 281 'showblocks' => '0', 282 'preferredbehaviour' => 'adaptive', 283 'reviewattempt' => '69888', 284 'reviewcorrectness' => '69888', 285 'reviewmarks' => '69888', 286 'reviewspecificfeedback' => '69888', 287 'reviewgeneralfeedback' => '69888', 288 'reviewrightanswer' => '69888', 289 'reviewoverallfeedback' => '4352', 290 ); 291 $attempt = (object) array( 292 'id' => '14', 293 'uniqueid' => '14', 294 'quiz' => '4', 295 'userid' => '4', 296 'attempt' => '2', 297 'sumgrades' => '2.80000', 298 'timestart' => '1305830661', 299 'timefinish' => '1305830729', 300 'timemodified' => '1305830729', 301 'layout' => '16,0,17,0,18,0', 302 'preview' => '0', 303 ); 304 $question = (object) array( 305 'id' => '17', 306 'category' => '2', 307 'parent' => '0', 308 'name' => 'Calculated multiple-choice', 309 'questiontext' => '<p>What is {a} + {b}?</p>', 310 'questiontextformat' => '1', 311 'generalfeedback' => '', 312 'generalfeedbackformat' => '1', 313 'defaultmark' => '1.0000000', 314 'penalty' => '0.1', 315 'qtype' => 'calculatedmulti', 316 'length' => '1', 317 'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv', 318 'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ', 319 'hidden' => '0', 320 'timecreated' => '1305830480', 321 'timemodified' => '1305830480', 322 'createdby' => '2', 323 'modifiedby' => '2', 324 'maxmark' => '1.0000000', 325 'options' => (object) array( 326 'id' => '1', 327 'question' => '17', 328 'synchronize' => '0', 329 'single' => '1', 330 'shuffleanswers' => '1', 331 'correctfeedback' => '', 332 'correctfeedbackformat' => '1', 333 'partiallycorrectfeedback' => '', 334 'partiallycorrectfeedbackformat' => '1', 335 'incorrectfeedback' => '', 336 'incorrectfeedbackformat' => '1', 337 'answernumbering' => 'abc', 338 'shownumcorrect' => '0', 339 'answers' => array( 340 24 => (object) array( 341 'id' => '24', 342 'question' => '17', 343 'answer' => '{={a} - {b}}', 344 'answerformat' => '0', 345 'fraction' => '0.0000000', 346 'feedback' => '', 347 'feedbackformat' => '1', 348 'tolerance' => '0.01', 349 'tolerancetype' => '1', 350 'correctanswerlength' => '2', 351 'correctanswerformat' => '1', 352 ), 353 25 => (object) array( 354 'id' => '25', 355 'question' => '17', 356 'answer' => '{={a} + {b}}', 357 'answerformat' => '0', 358 'fraction' => '1.0000000', 359 'feedback' => '', 360 'feedbackformat' => '1', 361 'tolerance' => '0.01', 362 'tolerancetype' => '1', 363 'correctanswerlength' => '2', 364 'correctanswerformat' => '1', 365 ), 366 26 => (object) array( 367 'id' => '26', 368 'question' => '17', 369 'answer' => '{={a} / {b}}', 370 'answerformat' => '0', 371 'fraction' => '0.0000000', 372 'feedback' => '', 373 'feedbackformat' => '1', 374 'tolerance' => '0.01', 375 'tolerancetype' => '1', 376 'correctanswerlength' => '2', 377 'correctanswerformat' => '1', 378 ), 379 27 => (object) array( 380 'id' => '27', 381 'question' => '17', 382 'answer' => '{={a} * {b}}', 383 'answerformat' => '0', 384 'fraction' => '0.0000000', 385 'feedback' => '', 386 'feedbackformat' => '1', 387 'tolerance' => '0.01', 388 'tolerancetype' => '1', 389 'correctanswerlength' => '2', 390 'correctanswerformat' => '1', 391 ), 392 ), 393 ), 394 'hints' => array( 395 ), 396 ); 397 $qsession = (object) array( 398 'id' => '99', 399 'attemptid' => '14', 400 'questionid' => '17', 401 'newest' => '268', 402 'newgraded' => '268', 403 'sumpenalty' => '0.2000000', 404 'manualcomment' => '', 405 'manualcommentformat' => '1', 406 'flagged' => '0', 407 ); 408 $qstates = array( 409 260 => (object) array( 410 'id' => '260', 411 'attempt' => '14', 412 'question' => '17', 413 'seq_number' => '0', 414 'answer' => 'dataset8-25,24,27,26:', 415 'timestamp' => '1305830661', 416 'event' => '0', 417 'grade' => '0.0000000', 418 'raw_grade' => '0.0000000', 419 'penalty' => '0.0000000', 420 ), 421 264 => (object) array( 422 'id' => '264', 423 'attempt' => '14', 424 'question' => '17', 425 'seq_number' => '1', 426 'answer' => 'dataset8-25,24,27,26:25', 427 'timestamp' => '1305830699', 428 'event' => '3', 429 'grade' => '1.0000000', 430 'raw_grade' => '1.0000000', 431 'penalty' => '0.1000000', 432 ), 433 268 => (object) array( 434 'id' => '268', 435 'attempt' => '14', 436 'question' => '17', 437 'seq_number' => '2', 438 'answer' => 'dataset8-25,24,27,26:25', 439 'timestamp' => '1305830699', 440 'event' => '6', 441 'grade' => '1.0000000', 442 'raw_grade' => '1.0000000', 443 'penalty' => '0.1000000', 444 ), 445 ); 446 $this->loader->put_dataset_in_cache($question->id, 8, array('a' => '3.7', 'b' => '6.0')); 447 448 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 449 450 $expectedqa = (object) array( 451 'behaviour' => 'adaptive', 452 'questionid' => 17, 453 'variant' => 8, 454 'maxmark' => 1.0000000, 455 'minfraction' => 0, 456 'maxfraction' => 1, 457 'flagged' => 0, 458 'questionsummary' => 'What is 3.7 + 6.0?', 459 'rightanswer' => '9.7', 460 'responsesummary' => '9.7', 461 'timemodified' => 1305830699, 462 'steps' => array( 463 0 => (object) array( 464 'sequencenumber' => 0, 465 'state' => 'todo', 466 'fraction' => null, 467 'timecreated' => 1305830661, 468 'userid' => 4, 469 'data' => array('_order' => '25,24,27,26', '_var_a' => '3.7', '_var_b' => '6.0'), 470 ), 471 1 => (object) array( 472 'sequencenumber' => 1, 473 'state' => 'complete', 474 'fraction' => 1, 475 'timecreated' => 1305830699, 476 'userid' => 4, 477 'data' => array('answer' => '0', '-submit' => 1, '-_try' => 1, '-_rawfraction' => 1), 478 ), 479 2 => (object) array( 480 'sequencenumber' => 2, 481 'state' => 'gradedright', 482 'fraction' => 1, 483 'timecreated' => 1305830699, 484 'userid' => 4, 485 'data' => array('answer' => '0', '-finish' => 1, '-_try' => 1, '-_rawfraction' => 1), 486 ), 487 ), 488 ); 489 490 $this->compare_qas($expectedqa, $qa); 491 } 492 493 public function test_calculatedmulti_adaptive_qsession102() { 494 $quiz = (object) array( 495 'id' => '4', 496 'course' => '2', 497 'name' => 'Calculated quiz', 498 'intro' => '', 499 'introformat' => '1', 500 'timeopen' => '0', 501 'timeclose' => '0', 502 'attempts' => '0', 503 'attemptonlast' => '0', 504 'grademethod' => '1', 505 'decimalpoints' => '2', 506 'questiondecimalpoints' => '-1', 507 'questionsperpage' => '1', 508 'shufflequestions' => '0', 509 'shuffleanswers' => '1', 510 'sumgrades' => '3.00000', 511 'grade' => '10.00000', 512 'timecreated' => '0', 513 'timemodified' => '1305648351', 514 'timelimit' => '0', 515 'password' => '', 516 'subnet' => '', 517 'popup' => '0', 518 'delay1' => '0', 519 'delay2' => '0', 520 'showuserpicture' => '0', 521 'showblocks' => '0', 522 'preferredbehaviour' => 'adaptive', 523 'reviewattempt' => '69888', 524 'reviewcorrectness' => '69888', 525 'reviewmarks' => '69888', 526 'reviewspecificfeedback' => '69888', 527 'reviewgeneralfeedback' => '69888', 528 'reviewrightanswer' => '69888', 529 'reviewoverallfeedback' => '4352', 530 ); 531 $attempt = (object) array( 532 'id' => '15', 533 'uniqueid' => '15', 534 'quiz' => '4', 535 'userid' => '3', 536 'attempt' => '1', 537 'sumgrades' => '0.70000', 538 'timestart' => '1305830744', 539 'timefinish' => '0', 540 'timemodified' => '1305830792', 541 'layout' => '16,0,17,0,18,0', 542 'preview' => '0', 543 ); 544 $question = (object) array( 545 'id' => '17', 546 'category' => '2', 547 'parent' => '0', 548 'name' => 'Calculated multiple-choice', 549 'questiontext' => '<p>What is {a} + {b}?</p>', 550 'questiontextformat' => '1', 551 'generalfeedback' => '', 552 'generalfeedbackformat' => '1', 553 'defaultmark' => '1.0000000', 554 'penalty' => '0.1', 555 'qtype' => 'calculatedmulti', 556 'length' => '1', 557 'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv', 558 'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ', 559 'hidden' => '0', 560 'timecreated' => '1305830480', 561 'timemodified' => '1305830480', 562 'createdby' => '2', 563 'modifiedby' => '2', 564 'maxmark' => '1.0000000', 565 'options' => (object) array( 566 'id' => '1', 567 'question' => '17', 568 'synchronize' => '0', 569 'single' => '1', 570 'shuffleanswers' => '1', 571 'correctfeedback' => '', 572 'correctfeedbackformat' => '1', 573 'partiallycorrectfeedback' => '', 574 'partiallycorrectfeedbackformat' => '1', 575 'incorrectfeedback' => '', 576 'incorrectfeedbackformat' => '1', 577 'answernumbering' => 'abc', 578 'shownumcorrect' => '0', 579 'answers' => array( 580 24 => (object) array( 581 'id' => '24', 582 'question' => '17', 583 'answer' => '{={a} - {b}}', 584 'answerformat' => '0', 585 'fraction' => '0.0000000', 586 'feedback' => '', 587 'feedbackformat' => '1', 588 'tolerance' => '0.01', 589 'tolerancetype' => '1', 590 'correctanswerlength' => '2', 591 'correctanswerformat' => '1', 592 ), 593 25 => (object) array( 594 'id' => '25', 595 'question' => '17', 596 'answer' => '{={a} + {b}}', 597 'answerformat' => '0', 598 'fraction' => '1.0000000', 599 'feedback' => '', 600 'feedbackformat' => '1', 601 'tolerance' => '0.01', 602 'tolerancetype' => '1', 603 'correctanswerlength' => '2', 604 'correctanswerformat' => '1', 605 ), 606 26 => (object) array( 607 'id' => '26', 608 'question' => '17', 609 'answer' => '{={a} / {b}}', 610 'answerformat' => '0', 611 'fraction' => '0.0000000', 612 'feedback' => '', 613 'feedbackformat' => '1', 614 'tolerance' => '0.01', 615 'tolerancetype' => '1', 616 'correctanswerlength' => '2', 617 'correctanswerformat' => '1', 618 ), 619 27 => (object) array( 620 'id' => '27', 621 'question' => '17', 622 'answer' => '{={a} * {b}}', 623 'answerformat' => '0', 624 'fraction' => '0.0000000', 625 'feedback' => '', 626 'feedbackformat' => '1', 627 'tolerance' => '0.01', 628 'tolerancetype' => '1', 629 'correctanswerlength' => '2', 630 'correctanswerformat' => '1', 631 ), 632 ), 633 ), 634 'hints' => array( 635 ), 636 ); 637 $qsession = (object) array( 638 'id' => '102', 639 'attemptid' => '15', 640 'questionid' => '17', 641 'newest' => '278', 642 'newgraded' => '278', 643 'sumpenalty' => '0.5000000', 644 'manualcomment' => '', 645 'manualcommentformat' => '1', 646 'flagged' => '0', 647 ); 648 $qstates = array( 649 271 => (object) array( 650 'id' => '271', 651 'attempt' => '15', 652 'question' => '17', 653 'seq_number' => '0', 654 'answer' => 'dataset7-26,24,25,27:', 655 'timestamp' => '1305830744', 656 'event' => '0', 657 'grade' => '0.0000000', 658 'raw_grade' => '0.0000000', 659 'penalty' => '0.0000000', 660 ), 661 274 => (object) array( 662 'id' => '274', 663 'attempt' => '15', 664 'question' => '17', 665 'seq_number' => '1', 666 'answer' => 'dataset7-26,24,25,27:27', 667 'timestamp' => '1305830759', 668 'event' => '3', 669 'grade' => '0.0000000', 670 'raw_grade' => '0.0000000', 671 'penalty' => '0.1000000', 672 ), 673 275 => (object) array( 674 'id' => '275', 675 'attempt' => '15', 676 'question' => '17', 677 'seq_number' => '2', 678 'answer' => 'dataset7-26,24,25,27:24', 679 'timestamp' => '1305830761', 680 'event' => '3', 681 'grade' => '0.0000000', 682 'raw_grade' => '0.0000000', 683 'penalty' => '0.1000000', 684 ), 685 276 => (object) array( 686 'id' => '276', 687 'attempt' => '15', 688 'question' => '17', 689 'seq_number' => '3', 690 'answer' => 'dataset7-26,24,25,27:26', 691 'timestamp' => '1305830764', 692 'event' => '3', 693 'grade' => '0.0000000', 694 'raw_grade' => '0.0000000', 695 'penalty' => '0.1000000', 696 ), 697 277 => (object) array( 698 'id' => '277', 699 'attempt' => '15', 700 'question' => '17', 701 'seq_number' => '4', 702 'answer' => 'dataset7-26,24,25,27:25', 703 'timestamp' => '1305830766', 704 'event' => '3', 705 'grade' => '0.7000000', 706 'raw_grade' => '1.0000000', 707 'penalty' => '0.1000000', 708 ), 709 278 => (object) array( 710 'id' => '278', 711 'attempt' => '15', 712 'question' => '17', 713 'seq_number' => '5', 714 'answer' => 'dataset7-26,24,25,27:24', 715 'timestamp' => '1305830768', 716 'event' => '3', 717 'grade' => '0.7000000', 718 'raw_grade' => '0.0000000', 719 'penalty' => '0.1000000', 720 ), 721 ); 722 $this->loader->put_dataset_in_cache($question->id, 7, array('a' => '4.4', 'b' => '8.2')); 723 724 $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates); 725 726 $expectedqa = (object) array( 727 'behaviour' => 'adaptive', 728 'questionid' => 17, 729 'variant' => 7, 730 'maxmark' => 1.0000000, 731 'minfraction' => 0, 732 'maxfraction' => 1, 733 'flagged' => 0, 734 'questionsummary' => 'What is 4.4 + 8.2?', 735 'rightanswer' => '12.6', 736 'responsesummary' => '-3.8', 737 'timemodified' => 1305830768, 738 'steps' => array( 739 0 => (object) array( 740 'sequencenumber' => 0, 741 'state' => 'todo', 742 'fraction' => null, 743 'timecreated' => 1305830744, 744 'userid' => 3, 745 'data' => array('_order' => '26,24,25,27', '_var_a' => '4.4', '_var_b' => '8.2'), 746 ), 747 1 => (object) array( 748 'sequencenumber' => 1, 749 'state' => 'todo', 750 'fraction' => 0, 751 'timecreated' => 1305830759, 752 'userid' => 3, 753 'data' => array('answer' => '3', '-submit' => 1, '-_try' => 1, '-_rawfraction' => 0), 754 ), 755 2 => (object) array( 756 'sequencenumber' => 2, 757 'state' => 'todo', 758 'fraction' => 0, 759 'timecreated' => 1305830761, 760 'userid' => 3, 761 'data' => array('answer' => '1', '-submit' => 1, '-_try' => 2, '-_rawfraction' => 0), 762 ), 763 3 => (object) array( 764 'sequencenumber' => 3, 765 'state' => 'todo', 766 'fraction' => 0, 767 'timecreated' => 1305830764, 768 'userid' => 3, 769 'data' => array('answer' => '0', '-submit' => 1, '-_try' => 3, '-_rawfraction' => 0), 770 ), 771 4 => (object) array( 772 'sequencenumber' => 4, 773 'state' => 'todo', 774 'fraction' => 0.7, 775 'timecreated' => 1305830766, 776 'userid' => 3, 777 'data' => array('answer' => '2', '-submit' => 1, '-_try' => 4, '-_rawfraction' => 1), 778 ), 779 5 => (object) array( 780 'sequencenumber' => 5, 781 'state' => 'todo', 782 'fraction' => 0.7, 783 'timecreated' => 1305830768, 784 'userid' => 3, 785 'data' => array('answer' => '1', '-submit' => 1, '-_try' => 5, '-_rawfraction' => 0), 786 ), 787 ), 788 ); 789 790 $this->compare_qas($expectedqa, $qa); 791 } 792 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body