Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/question/type/calculatedmulti/db/simpletest/testupgradelibnewqe.php
Go to the documentation of this file.
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_calculatedmulti_attempt_upgrader_test extends question_attempt_upgrader_test_base {
00040     public function test_calculatedmulti_adaptive_qsession96() {
00041         $quiz = (object) array(
00042             'id' => '4',
00043             'course' => '2',
00044             'name' => 'Calculated quiz',
00045             'intro' => '',
00046             'introformat' => '1',
00047             'timeopen' => '0',
00048             'timeclose' => '0',
00049             'attempts' => '0',
00050             'attemptonlast' => '0',
00051             'grademethod' => '1',
00052             'decimalpoints' => '2',
00053             'questiondecimalpoints' => '-1',
00054             'questionsperpage' => '1',
00055             'shufflequestions' => '0',
00056             'shuffleanswers' => '1',
00057             'questions' => '16,0,17,0,18,0',
00058             'sumgrades' => '3.00000',
00059             'grade' => '10.00000',
00060             'timecreated' => '0',
00061             'timemodified' => '1305648351',
00062             'timelimit' => '0',
00063             'password' => '',
00064             'subnet' => '',
00065             'popup' => '0',
00066             'delay1' => '0',
00067             'delay2' => '0',
00068             'showuserpicture' => '0',
00069             'showblocks' => '0',
00070             'preferredbehaviour' => 'adaptive',
00071             'reviewattempt' => '69888',
00072             'reviewcorrectness' => '69888',
00073             'reviewmarks' => '69888',
00074             'reviewspecificfeedback' => '69888',
00075             'reviewgeneralfeedback' => '69888',
00076             'reviewrightanswer' => '69888',
00077             'reviewoverallfeedback' => '4352',
00078         );
00079         $attempt = (object) array(
00080             'id' => '13',
00081             'uniqueid' => '13',
00082             'quiz' => '4',
00083             'userid' => '4',
00084             'attempt' => '1',
00085             'sumgrades' => '0.00000',
00086             'timestart' => '1305830650',
00087             'timefinish' => '1305830656',
00088             'timemodified' => '1305830656',
00089             'layout' => '16,0,17,0,18,0',
00090             'preview' => '0',
00091             'needsupgradetonewqe' => 1,
00092         );
00093         $question = (object) array(
00094             'id' => '17',
00095             'category' => '2',
00096             'parent' => '0',
00097             'name' => 'Calculated multiple-choice',
00098             'questiontext' => '<p>What is {a} + {b}?</p>',
00099             'questiontextformat' => '1',
00100             'generalfeedback' => '',
00101             'generalfeedbackformat' => '1',
00102             'defaultmark' => '1.0000000',
00103             'penalty' => '0.1',
00104             'qtype' => 'calculatedmulti',
00105             'length' => '1',
00106             'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv',
00107             'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ',
00108             'hidden' => '0',
00109             'timecreated' => '1305830480',
00110             'timemodified' => '1305830480',
00111             'createdby' => '2',
00112             'modifiedby' => '2',
00113             'maxmark' => '1.0000000',
00114             'options' => (object) array(
00115                 'id' => '1',
00116                 'question' => '17',
00117                 'synchronize' => '0',
00118                 'single' => '1',
00119                 'shuffleanswers' => '1',
00120                 'correctfeedback' => '',
00121                 'correctfeedbackformat' => '1',
00122                 'partiallycorrectfeedback' => '',
00123                 'partiallycorrectfeedbackformat' => '1',
00124                 'incorrectfeedback' => '',
00125                 'incorrectfeedbackformat' => '1',
00126                 'answernumbering' => 'abc',
00127                 'shownumcorrect' => '0',
00128                 'answers' => array(
00129                     24 => (object) array(
00130                         'id' => '24',
00131                         'question' => '17',
00132                         'answer' => '{={a} - {b}}',
00133                         'answerformat' => '0',
00134                         'fraction' => '0.0000000',
00135                         'feedback' => '',
00136                         'feedbackformat' => '1',
00137                         'tolerance' => '0.01',
00138                         'tolerancetype' => '1',
00139                         'correctanswerlength' => '2',
00140                         'correctanswerformat' => '1',
00141                     ),
00142                     25 => (object) array(
00143                         'id' => '25',
00144                         'question' => '17',
00145                         'answer' => '{={a} + {b}}',
00146                         'answerformat' => '0',
00147                         'fraction' => '1.0000000',
00148                         'feedback' => '',
00149                         'feedbackformat' => '1',
00150                         'tolerance' => '0.01',
00151                         'tolerancetype' => '1',
00152                         'correctanswerlength' => '2',
00153                         'correctanswerformat' => '1',
00154                     ),
00155                     26 => (object) array(
00156                         'id' => '26',
00157                         'question' => '17',
00158                         'answer' => '{={a} / {b}}',
00159                         'answerformat' => '0',
00160                         'fraction' => '0.0000000',
00161                         'feedback' => '',
00162                         'feedbackformat' => '1',
00163                         'tolerance' => '0.01',
00164                         'tolerancetype' => '1',
00165                         'correctanswerlength' => '2',
00166                         'correctanswerformat' => '1',
00167                     ),
00168                     27 => (object) array(
00169                         'id' => '27',
00170                         'question' => '17',
00171                         'answer' => '{={a} * {b}}',
00172                         'answerformat' => '0',
00173                         'fraction' => '0.0000000',
00174                         'feedback' => '',
00175                         'feedbackformat' => '1',
00176                         'tolerance' => '0.01',
00177                         'tolerancetype' => '1',
00178                         'correctanswerlength' => '2',
00179                         'correctanswerformat' => '1',
00180                     ),
00181                 ),
00182             ),
00183             'hints' => array(
00184             ),
00185         );
00186         $qsession = (object) array(
00187             'id' => '96',
00188             'attemptid' => '13',
00189             'questionid' => '17',
00190             'newest' => '257',
00191             'newgraded' => '257',
00192             'sumpenalty' => '0.1000000',
00193             'manualcomment' => '',
00194             'manualcommentformat' => '1',
00195             'flagged' => '0',
00196         );
00197         $qstates = array(
00198             254 => (object) array(
00199                 'id' => '254',
00200                 'attempt' => '13',
00201                 'question' => '17',
00202                 'seq_number' => '0',
00203                 'answer' => 'dataset3-24,26,27,25:',
00204                 'timestamp' => '1305830650',
00205                 'event' => '0',
00206                 'grade' => '0.0000000',
00207                 'raw_grade' => '0.0000000',
00208                 'penalty' => '0.0000000',
00209             ),
00210             257 => (object) array(
00211                 'id' => '257',
00212                 'attempt' => '13',
00213                 'question' => '17',
00214                 'seq_number' => '1',
00215                 'answer' => 'dataset3-24,26,27,25:',
00216                 'timestamp' => '1305830650',
00217                 'event' => '6',
00218                 'grade' => '0.0000000',
00219                 'raw_grade' => '0.0000000',
00220                 'penalty' => '0.1000000',
00221             ),
00222         );
00223         $this->loader->put_dataset_in_cache($question->id, 3, array('a' => '4.3', 'b' => '5.4'));
00224 
00225         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00226 
00227         $expectedqa = (object) array(
00228             'behaviour' => 'adaptive',
00229             'questionid' => 17,
00230             'variant' => 3,
00231             'maxmark' => 1.0000000,
00232             'minfraction' => 0,
00233             'flagged' => 0,
00234             'questionsummary' => 'What is 4.3 + 5.4?',
00235             'rightanswer' => '9.7',
00236             'responsesummary' => '',
00237             'timemodified' => 1305830650,
00238             'steps' => array(
00239                 0 => (object) array(
00240                     'sequencenumber' => 0,
00241                     'state' => 'todo',
00242                     'fraction' => null,
00243                     'timecreated' => 1305830650,
00244                     'userid' => 4,
00245                     'data' => array('_order' => '24,26,27,25', '_var_a' => '4.3', '_var_b' => '5.4'),
00246                 ),
00247                 1 => (object) array(
00248                     'sequencenumber' => 1,
00249                     'state' => 'gradedwrong',
00250                     'fraction' => null,
00251                     'timecreated' => 1305830650,
00252                     'userid' => 4,
00253                     'data' => array('-finish' => 1, '-_try' => 1, '-_rawfraction' => 0),
00254                 ),
00255             ),
00256         );
00257 
00258         $this->compare_qas($expectedqa, $qa);
00259     }
00260 
00261     public function test_calculatedmulti_adaptive_qsession99() {
00262         $quiz = (object) array(
00263             'id' => '4',
00264             'course' => '2',
00265             'name' => 'Calculated quiz',
00266             'intro' => '',
00267             'introformat' => '1',
00268             'timeopen' => '0',
00269             'timeclose' => '0',
00270             'attempts' => '0',
00271             'attemptonlast' => '0',
00272             'grademethod' => '1',
00273             'decimalpoints' => '2',
00274             'questiondecimalpoints' => '-1',
00275             'questionsperpage' => '1',
00276             'shufflequestions' => '0',
00277             'shuffleanswers' => '1',
00278             'questions' => '16,0,17,0,18,0',
00279             'sumgrades' => '3.00000',
00280             'grade' => '10.00000',
00281             'timecreated' => '0',
00282             'timemodified' => '1305648351',
00283             'timelimit' => '0',
00284             'password' => '',
00285             'subnet' => '',
00286             'popup' => '0',
00287             'delay1' => '0',
00288             'delay2' => '0',
00289             'showuserpicture' => '0',
00290             'showblocks' => '0',
00291             'preferredbehaviour' => 'adaptive',
00292             'reviewattempt' => '69888',
00293             'reviewcorrectness' => '69888',
00294             'reviewmarks' => '69888',
00295             'reviewspecificfeedback' => '69888',
00296             'reviewgeneralfeedback' => '69888',
00297             'reviewrightanswer' => '69888',
00298             'reviewoverallfeedback' => '4352',
00299         );
00300         $attempt = (object) array(
00301             'id' => '14',
00302             'uniqueid' => '14',
00303             'quiz' => '4',
00304             'userid' => '4',
00305             'attempt' => '2',
00306             'sumgrades' => '2.80000',
00307             'timestart' => '1305830661',
00308             'timefinish' => '1305830729',
00309             'timemodified' => '1305830729',
00310             'layout' => '16,0,17,0,18,0',
00311             'preview' => '0',
00312             'needsupgradetonewqe' => 1,
00313         );
00314         $question = (object) array(
00315             'id' => '17',
00316             'category' => '2',
00317             'parent' => '0',
00318             'name' => 'Calculated multiple-choice',
00319             'questiontext' => '<p>What is {a} + {b}?</p>',
00320             'questiontextformat' => '1',
00321             'generalfeedback' => '',
00322             'generalfeedbackformat' => '1',
00323             'defaultmark' => '1.0000000',
00324             'penalty' => '0.1',
00325             'qtype' => 'calculatedmulti',
00326             'length' => '1',
00327             'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv',
00328             'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ',
00329             'hidden' => '0',
00330             'timecreated' => '1305830480',
00331             'timemodified' => '1305830480',
00332             'createdby' => '2',
00333             'modifiedby' => '2',
00334             'maxmark' => '1.0000000',
00335             'options' => (object) array(
00336                 'id' => '1',
00337                 'question' => '17',
00338                 'synchronize' => '0',
00339                 'single' => '1',
00340                 'shuffleanswers' => '1',
00341                 'correctfeedback' => '',
00342                 'correctfeedbackformat' => '1',
00343                 'partiallycorrectfeedback' => '',
00344                 'partiallycorrectfeedbackformat' => '1',
00345                 'incorrectfeedback' => '',
00346                 'incorrectfeedbackformat' => '1',
00347                 'answernumbering' => 'abc',
00348                 'shownumcorrect' => '0',
00349                 'answers' => array(
00350                     24 => (object) array(
00351                         'id' => '24',
00352                         'question' => '17',
00353                         'answer' => '{={a} - {b}}',
00354                         'answerformat' => '0',
00355                         'fraction' => '0.0000000',
00356                         'feedback' => '',
00357                         'feedbackformat' => '1',
00358                         'tolerance' => '0.01',
00359                         'tolerancetype' => '1',
00360                         'correctanswerlength' => '2',
00361                         'correctanswerformat' => '1',
00362                     ),
00363                     25 => (object) array(
00364                         'id' => '25',
00365                         'question' => '17',
00366                         'answer' => '{={a} + {b}}',
00367                         'answerformat' => '0',
00368                         'fraction' => '1.0000000',
00369                         'feedback' => '',
00370                         'feedbackformat' => '1',
00371                         'tolerance' => '0.01',
00372                         'tolerancetype' => '1',
00373                         'correctanswerlength' => '2',
00374                         'correctanswerformat' => '1',
00375                     ),
00376                     26 => (object) array(
00377                         'id' => '26',
00378                         'question' => '17',
00379                         'answer' => '{={a} / {b}}',
00380                         'answerformat' => '0',
00381                         'fraction' => '0.0000000',
00382                         'feedback' => '',
00383                         'feedbackformat' => '1',
00384                         'tolerance' => '0.01',
00385                         'tolerancetype' => '1',
00386                         'correctanswerlength' => '2',
00387                         'correctanswerformat' => '1',
00388                     ),
00389                     27 => (object) array(
00390                         'id' => '27',
00391                         'question' => '17',
00392                         'answer' => '{={a} * {b}}',
00393                         'answerformat' => '0',
00394                         'fraction' => '0.0000000',
00395                         'feedback' => '',
00396                         'feedbackformat' => '1',
00397                         'tolerance' => '0.01',
00398                         'tolerancetype' => '1',
00399                         'correctanswerlength' => '2',
00400                         'correctanswerformat' => '1',
00401                     ),
00402                 ),
00403             ),
00404             'hints' => array(
00405             ),
00406         );
00407         $qsession = (object) array(
00408             'id' => '99',
00409             'attemptid' => '14',
00410             'questionid' => '17',
00411             'newest' => '268',
00412             'newgraded' => '268',
00413             'sumpenalty' => '0.2000000',
00414             'manualcomment' => '',
00415             'manualcommentformat' => '1',
00416             'flagged' => '0',
00417         );
00418         $qstates = array(
00419             260 => (object) array(
00420                 'id' => '260',
00421                 'attempt' => '14',
00422                 'question' => '17',
00423                 'seq_number' => '0',
00424                 'answer' => 'dataset8-25,24,27,26:',
00425                 'timestamp' => '1305830661',
00426                 'event' => '0',
00427                 'grade' => '0.0000000',
00428                 'raw_grade' => '0.0000000',
00429                 'penalty' => '0.0000000',
00430             ),
00431             264 => (object) array(
00432                 'id' => '264',
00433                 'attempt' => '14',
00434                 'question' => '17',
00435                 'seq_number' => '1',
00436                 'answer' => 'dataset8-25,24,27,26:25',
00437                 'timestamp' => '1305830699',
00438                 'event' => '3',
00439                 'grade' => '1.0000000',
00440                 'raw_grade' => '1.0000000',
00441                 'penalty' => '0.1000000',
00442             ),
00443             268 => (object) array(
00444                 'id' => '268',
00445                 'attempt' => '14',
00446                 'question' => '17',
00447                 'seq_number' => '2',
00448                 'answer' => 'dataset8-25,24,27,26:25',
00449                 'timestamp' => '1305830699',
00450                 'event' => '6',
00451                 'grade' => '1.0000000',
00452                 'raw_grade' => '1.0000000',
00453                 'penalty' => '0.1000000',
00454             ),
00455         );
00456         $this->loader->put_dataset_in_cache($question->id, 8, array('a' => '3.7', 'b' => '6.0'));
00457 
00458         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00459 
00460         $expectedqa = (object) array(
00461             'behaviour' => 'adaptive',
00462             'questionid' => 17,
00463             'variant' => 8,
00464             'maxmark' => 1.0000000,
00465             'minfraction' => 0,
00466             'flagged' => 0,
00467             'questionsummary' => 'What is 3.7 + 6.0?',
00468             'rightanswer' => '9.7',
00469             'responsesummary' => '9.7',
00470             'timemodified' => 1305830699,
00471             'steps' => array(
00472                 0 => (object) array(
00473                     'sequencenumber' => 0,
00474                     'state' => 'todo',
00475                     'fraction' => null,
00476                     'timecreated' => 1305830661,
00477                     'userid' => 4,
00478                     'data' => array('_order' => '25,24,27,26', '_var_a' => '3.7', '_var_b' => '6.0'),
00479                 ),
00480                 1 => (object) array(
00481                     'sequencenumber' => 1,
00482                     'state' => 'complete',
00483                     'fraction' => 1,
00484                     'timecreated' => 1305830699,
00485                     'userid' => 4,
00486                     'data' => array('answer' => '0', '-submit' => 1, '-_try' => 1, '-_rawfraction' => 1),
00487                 ),
00488                 2 => (object) array(
00489                     'sequencenumber' => 2,
00490                     'state' => 'gradedright',
00491                     'fraction' => 1,
00492                     'timecreated' => 1305830699,
00493                     'userid' => 4,
00494                     'data' => array('answer' => '0', '-finish' => 1, '-_try' => 1, '-_rawfraction' => 1),
00495                 ),
00496             ),
00497         );
00498 
00499         $this->compare_qas($expectedqa, $qa);
00500     }
00501 
00502     public function test_calculatedmulti_adaptive_qsession102() {
00503         $quiz = (object) array(
00504             'id' => '4',
00505             'course' => '2',
00506             'name' => 'Calculated quiz',
00507             'intro' => '',
00508             'introformat' => '1',
00509             'timeopen' => '0',
00510             'timeclose' => '0',
00511             'attempts' => '0',
00512             'attemptonlast' => '0',
00513             'grademethod' => '1',
00514             'decimalpoints' => '2',
00515             'questiondecimalpoints' => '-1',
00516             'questionsperpage' => '1',
00517             'shufflequestions' => '0',
00518             'shuffleanswers' => '1',
00519             'questions' => '16,0,17,0,18,0',
00520             'sumgrades' => '3.00000',
00521             'grade' => '10.00000',
00522             'timecreated' => '0',
00523             'timemodified' => '1305648351',
00524             'timelimit' => '0',
00525             'password' => '',
00526             'subnet' => '',
00527             'popup' => '0',
00528             'delay1' => '0',
00529             'delay2' => '0',
00530             'showuserpicture' => '0',
00531             'showblocks' => '0',
00532             'preferredbehaviour' => 'adaptive',
00533             'reviewattempt' => '69888',
00534             'reviewcorrectness' => '69888',
00535             'reviewmarks' => '69888',
00536             'reviewspecificfeedback' => '69888',
00537             'reviewgeneralfeedback' => '69888',
00538             'reviewrightanswer' => '69888',
00539             'reviewoverallfeedback' => '4352',
00540         );
00541         $attempt = (object) array(
00542             'id' => '15',
00543             'uniqueid' => '15',
00544             'quiz' => '4',
00545             'userid' => '3',
00546             'attempt' => '1',
00547             'sumgrades' => '0.70000',
00548             'timestart' => '1305830744',
00549             'timefinish' => '0',
00550             'timemodified' => '1305830792',
00551             'layout' => '16,0,17,0,18,0',
00552             'preview' => '0',
00553             'needsupgradetonewqe' => 1,
00554         );
00555         $question = (object) array(
00556             'id' => '17',
00557             'category' => '2',
00558             'parent' => '0',
00559             'name' => 'Calculated multiple-choice',
00560             'questiontext' => '<p>What is {a} + {b}?</p>',
00561             'questiontextformat' => '1',
00562             'generalfeedback' => '',
00563             'generalfeedbackformat' => '1',
00564             'defaultmark' => '1.0000000',
00565             'penalty' => '0.1',
00566             'qtype' => 'calculatedmulti',
00567             'length' => '1',
00568             'stamp' => 'tjh238.vledev2.open.ac.uk+110519184120+gpbLCv',
00569             'version' => 'tjh238.vledev2.open.ac.uk+110519184120+P5jpWJ',
00570             'hidden' => '0',
00571             'timecreated' => '1305830480',
00572             'timemodified' => '1305830480',
00573             'createdby' => '2',
00574             'modifiedby' => '2',
00575             'maxmark' => '1.0000000',
00576             'options' => (object) array(
00577                 'id' => '1',
00578                 'question' => '17',
00579                 'synchronize' => '0',
00580                 'single' => '1',
00581                 'shuffleanswers' => '1',
00582                 'correctfeedback' => '',
00583                 'correctfeedbackformat' => '1',
00584                 'partiallycorrectfeedback' => '',
00585                 'partiallycorrectfeedbackformat' => '1',
00586                 'incorrectfeedback' => '',
00587                 'incorrectfeedbackformat' => '1',
00588                 'answernumbering' => 'abc',
00589                 'shownumcorrect' => '0',
00590                 'answers' => array(
00591                     24 => (object) array(
00592                         'id' => '24',
00593                         'question' => '17',
00594                         'answer' => '{={a} - {b}}',
00595                         'answerformat' => '0',
00596                         'fraction' => '0.0000000',
00597                         'feedback' => '',
00598                         'feedbackformat' => '1',
00599                         'tolerance' => '0.01',
00600                         'tolerancetype' => '1',
00601                         'correctanswerlength' => '2',
00602                         'correctanswerformat' => '1',
00603                     ),
00604                     25 => (object) array(
00605                         'id' => '25',
00606                         'question' => '17',
00607                         'answer' => '{={a} + {b}}',
00608                         'answerformat' => '0',
00609                         'fraction' => '1.0000000',
00610                         'feedback' => '',
00611                         'feedbackformat' => '1',
00612                         'tolerance' => '0.01',
00613                         'tolerancetype' => '1',
00614                         'correctanswerlength' => '2',
00615                         'correctanswerformat' => '1',
00616                     ),
00617                     26 => (object) array(
00618                         'id' => '26',
00619                         'question' => '17',
00620                         'answer' => '{={a} / {b}}',
00621                         'answerformat' => '0',
00622                         'fraction' => '0.0000000',
00623                         'feedback' => '',
00624                         'feedbackformat' => '1',
00625                         'tolerance' => '0.01',
00626                         'tolerancetype' => '1',
00627                         'correctanswerlength' => '2',
00628                         'correctanswerformat' => '1',
00629                     ),
00630                     27 => (object) array(
00631                         'id' => '27',
00632                         'question' => '17',
00633                         'answer' => '{={a} * {b}}',
00634                         'answerformat' => '0',
00635                         'fraction' => '0.0000000',
00636                         'feedback' => '',
00637                         'feedbackformat' => '1',
00638                         'tolerance' => '0.01',
00639                         'tolerancetype' => '1',
00640                         'correctanswerlength' => '2',
00641                         'correctanswerformat' => '1',
00642                     ),
00643                 ),
00644             ),
00645             'hints' => array(
00646             ),
00647         );
00648         $qsession = (object) array(
00649             'id' => '102',
00650             'attemptid' => '15',
00651             'questionid' => '17',
00652             'newest' => '278',
00653             'newgraded' => '278',
00654             'sumpenalty' => '0.5000000',
00655             'manualcomment' => '',
00656             'manualcommentformat' => '1',
00657             'flagged' => '0',
00658         );
00659         $qstates = array(
00660             271 => (object) array(
00661                 'id' => '271',
00662                 'attempt' => '15',
00663                 'question' => '17',
00664                 'seq_number' => '0',
00665                 'answer' => 'dataset7-26,24,25,27:',
00666                 'timestamp' => '1305830744',
00667                 'event' => '0',
00668                 'grade' => '0.0000000',
00669                 'raw_grade' => '0.0000000',
00670                 'penalty' => '0.0000000',
00671             ),
00672             274 => (object) array(
00673                 'id' => '274',
00674                 'attempt' => '15',
00675                 'question' => '17',
00676                 'seq_number' => '1',
00677                 'answer' => 'dataset7-26,24,25,27:27',
00678                 'timestamp' => '1305830759',
00679                 'event' => '3',
00680                 'grade' => '0.0000000',
00681                 'raw_grade' => '0.0000000',
00682                 'penalty' => '0.1000000',
00683             ),
00684             275 => (object) array(
00685                 'id' => '275',
00686                 'attempt' => '15',
00687                 'question' => '17',
00688                 'seq_number' => '2',
00689                 'answer' => 'dataset7-26,24,25,27:24',
00690                 'timestamp' => '1305830761',
00691                 'event' => '3',
00692                 'grade' => '0.0000000',
00693                 'raw_grade' => '0.0000000',
00694                 'penalty' => '0.1000000',
00695             ),
00696             276 => (object) array(
00697                 'id' => '276',
00698                 'attempt' => '15',
00699                 'question' => '17',
00700                 'seq_number' => '3',
00701                 'answer' => 'dataset7-26,24,25,27:26',
00702                 'timestamp' => '1305830764',
00703                 'event' => '3',
00704                 'grade' => '0.0000000',
00705                 'raw_grade' => '0.0000000',
00706                 'penalty' => '0.1000000',
00707             ),
00708             277 => (object) array(
00709                 'id' => '277',
00710                 'attempt' => '15',
00711                 'question' => '17',
00712                 'seq_number' => '4',
00713                 'answer' => 'dataset7-26,24,25,27:25',
00714                 'timestamp' => '1305830766',
00715                 'event' => '3',
00716                 'grade' => '0.7000000',
00717                 'raw_grade' => '1.0000000',
00718                 'penalty' => '0.1000000',
00719             ),
00720             278 => (object) array(
00721                 'id' => '278',
00722                 'attempt' => '15',
00723                 'question' => '17',
00724                 'seq_number' => '5',
00725                 'answer' => 'dataset7-26,24,25,27:24',
00726                 'timestamp' => '1305830768',
00727                 'event' => '3',
00728                 'grade' => '0.7000000',
00729                 'raw_grade' => '0.0000000',
00730                 'penalty' => '0.1000000',
00731             ),
00732         );
00733         $this->loader->put_dataset_in_cache($question->id, 7, array('a' => '4.4', 'b' => '8.2'));
00734 
00735         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00736 
00737         $expectedqa = (object) array(
00738             'behaviour' => 'adaptive',
00739             'questionid' => 17,
00740             'variant' => 7,
00741             'maxmark' => 1.0000000,
00742             'minfraction' => 0,
00743             'flagged' => 0,
00744             'questionsummary' => 'What is 4.4 + 8.2?',
00745             'rightanswer' => '12.6',
00746             'responsesummary' => '-3.8',
00747             'timemodified' => 1305830768,
00748             'steps' => array(
00749                 0 => (object) array(
00750                     'sequencenumber' => 0,
00751                     'state' => 'todo',
00752                     'fraction' => null,
00753                     'timecreated' => 1305830744,
00754                     'userid' => 3,
00755                     'data' => array('_order' => '26,24,25,27', '_var_a' => '4.4', '_var_b' => '8.2'),
00756                 ),
00757                 1 => (object) array(
00758                     'sequencenumber' => 1,
00759                     'state' => 'todo',
00760                     'fraction' => 0,
00761                     'timecreated' => 1305830759,
00762                     'userid' => 3,
00763                     'data' => array('answer' => '3', '-submit' => 1, '-_try' => 1, '-_rawfraction' => 0),
00764                 ),
00765                 2 => (object) array(
00766                     'sequencenumber' => 2,
00767                     'state' => 'todo',
00768                     'fraction' => 0,
00769                     'timecreated' => 1305830761,
00770                     'userid' => 3,
00771                     'data' => array('answer' => '1', '-submit' => 1, '-_try' => 2, '-_rawfraction' => 0),
00772                 ),
00773                 3 => (object) array(
00774                     'sequencenumber' => 3,
00775                     'state' => 'todo',
00776                     'fraction' => 0,
00777                     'timecreated' => 1305830764,
00778                     'userid' => 3,
00779                     'data' => array('answer' => '0', '-submit' => 1, '-_try' => 3, '-_rawfraction' => 0),
00780                 ),
00781                 4 => (object) array(
00782                     'sequencenumber' => 4,
00783                     'state' => 'todo',
00784                     'fraction' => 0.7,
00785                     'timecreated' => 1305830766,
00786                     'userid' => 3,
00787                     'data' => array('answer' => '2', '-submit' => 1, '-_try' => 4, '-_rawfraction' => 1),
00788                 ),
00789                 5 => (object) array(
00790                     'sequencenumber' => 5,
00791                     'state' => 'todo',
00792                     'fraction' => 0.7,
00793                     'timecreated' => 1305830768,
00794                     'userid' => 3,
00795                     'data' => array('answer' => '1', '-submit' => 1, '-_try' => 5, '-_rawfraction' => 0),
00796                 ),
00797             ),
00798         );
00799 
00800         $this->compare_qas($expectedqa, $qa);
00801     }
00802 }
 All Data Structures Namespaces Files Functions Variables Enumerations