Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/question/type/description/simpletest/helper.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 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00029 
00036 class qtype_description_test_helper extends question_test_helper {
00037     public function get_test_questions() {
00038         return array('info');
00039     }
00040 
00044     public static function make_description_question_info() {
00045         question_bank::load_question_definition_classes('description');
00046         $q = new qtype_description_question();
00047 
00048         test_question_maker::initialise_a_question($q);
00049         $q->defaultmark = 0;
00050         $q->penalty = 0;
00051         $q->length = 0;
00052 
00053         $q->name = 'Description';
00054         $q->questiontext = 'Here is some information about the questions you are about to attempt.';
00055         $q->generalfeedback = 'And here is some more text shown only on the review page.';
00056         $q->qtype = question_bank::get_qtype('description');
00057 
00058         return $q;
00059     }
00060 
00066     public static function get_question_data() {
00067         global $USER;
00068 
00069         $qdata = new stdClass();
00070         $qdata->id = 0;
00071         $qdata->contextid = 0;
00072         $qdata->category = 0;
00073         $qdata->parent = 0;
00074         $qdata->stamp = make_unique_id_code();
00075         $qdata->version = make_unique_id_code();
00076         $qdata->timecreated = time();
00077         $qdata->timemodified = time();
00078         $qdata->createdby = $USER->id;
00079         $qdata->modifiedby = $USER->id;
00080         $qdata->qtype = 'description';
00081         $qdata->name = 'Description';
00082         $qdata->questiontext = 'Here is some information about the questions you are about to attempt.';
00083         $qdata->questiontextformat = FORMAT_HTML;
00084         $qdata->generalfeedback = 'And here is some more text shown only on the review page.';
00085         $qdata->generalfeedbackformat = FORMAT_HTML;
00086         $qdata->defaultmark = 0;
00087         $qdata->length = 0;
00088         $qdata->penalty = 0;
00089         $qdata->hidden = 0;
00090 
00091         return $qdata;
00092     }
00093 }
 All Data Structures Namespaces Files Functions Variables Enumerations