[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
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 * Contains the helper class for the select missing words question type tests. 19 * 20 * @package qtype_gapselect 21 * @copyright 2011 The Open University 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 29 /** 30 * Test helper class for the select missing words question type. 31 * 32 * @copyright 2011 The Open University 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class qtype_gapselect_test_helper { 36 /** 37 * Get an example gapselect question to use for testing. This examples has one of each item. 38 * @return qtype_gapselect_question 39 */ 40 public static function make_a_gapselect_question() { 41 question_bank::load_question_definition_classes('gapselect'); 42 $gapselect = new qtype_gapselect_question(); 43 44 test_question_maker::initialise_a_question($gapselect); 45 46 $gapselect->name = 'Selection from drop down list question'; 47 $gapselect->questiontext = 'The [[1]] brown [[2]] jumped over the [[3]] dog.'; 48 $gapselect->generalfeedback = 'This sentence uses each letter of the alphabet.'; 49 $gapselect->qtype = question_bank::get_qtype('gapselect'); 50 51 $gapselect->shufflechoices = true; 52 53 test_question_maker::set_standard_combined_feedback_fields($gapselect); 54 55 $gapselect->choices = array( 56 1 => array( 57 1 => new qtype_gapselect_choice('quick', 1), 58 2 => new qtype_gapselect_choice('slow', 1)), 59 2 => array( 60 1 => new qtype_gapselect_choice('fox', 2), 61 2 => new qtype_gapselect_choice('dog', 2)), 62 3 => array( 63 1 => new qtype_gapselect_choice('lazy', 3), 64 2 => new qtype_gapselect_choice('assiduous', 3)), 65 ); 66 67 $gapselect->places = array(1 => 1, 2 => 2, 3 => 3); 68 $gapselect->rightchoices = array(1 => 1, 2 => 1, 3 => 1); 69 $gapselect->textfragments = array('The ', ' brown ', ' jumped over the ', ' dog.'); 70 71 return $gapselect; 72 } 73 74 /** 75 * Get an example gapselect question to use for testing. This exmples had unlimited items. 76 * @return qtype_gapselect_question 77 */ 78 public static function make_a_maths_gapselect_question() { 79 question_bank::load_question_definition_classes('gapselect'); 80 $gapselect = new qtype_gapselect_question(); 81 82 test_question_maker::initialise_a_question($gapselect); 83 84 $gapselect->name = 'Selection from drop down list question'; 85 $gapselect->questiontext = 'Fill in the operators to make this equation work: ' . 86 '7 [[1]] 11 [[2]] 13 [[1]] 17 [[2]] 19 = 3'; 87 $gapselect->generalfeedback = 'This sentence uses each letter of the alphabet.'; 88 $gapselect->qtype = question_bank::get_qtype('gapselect'); 89 90 $gapselect->shufflechoices = true; 91 92 test_question_maker::set_standard_combined_feedback_fields($gapselect); 93 94 $gapselect->choices = array( 95 1 => array( 96 1 => new qtype_gapselect_choice('+', 1, true), 97 2 => new qtype_gapselect_choice('-', 1, true), 98 3 => new qtype_gapselect_choice('*', 1, true), 99 4 => new qtype_gapselect_choice('/', 1, true), 100 )); 101 102 $gapselect->places = array(1 => 1, 2 => 1, 3 => 1, 4 => 1); 103 $gapselect->rightchoices = array(1 => 1, 2 => 2, 3 => 1, 4 => 2); 104 $gapselect->textfragments = array('7 ', ' 11 ', ' 13 ', ' 17 ', ' 19 = 3'); 105 106 return $gapselect; 107 } 108 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |