MDL-61410 question: fix unit tests failures
[moodle.git] / question / type / ddwtos / tests / questiontype_test.php
CommitLineData
61381e50 1<?php
61381e50
TH
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
61381e50
TH
17/**
18 * Unit tests for the drag-and-drop words into sentences question definition class.
19 *
025589c7
TH
20 * @package qtype_ddwtos
21 * @copyright 2012 The Open University
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
61381e50
TH
23 */
24
25
9d55f4a5 26defined('MOODLE_INTERNAL') || die();
543e4dee 27global $CFG;
9d55f4a5 28
543e4dee
JP
29require_once($CFG->dirroot . '/question/engine/tests/helpers.php');
30require_once($CFG->dirroot . '/question/type/ddwtos/tests/helper.php');
61381e50
TH
31
32
33/**
34 * Unit tests for the drag-and-drop words into sentences question definition class.
35 *
025589c7
TH
36 * @copyright 2012 The Open University
37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
61381e50 38 */
543e4dee 39class qtype_ddwtos_test extends question_testcase {
61381e50
TH
40 /** @var qtype_ddwtos instance of the question type class to test. */
41 protected $qtype;
42
543e4dee 43 protected function setUp() {
61381e50
TH
44 $this->qtype = question_bank::get_qtype('ddwtos');;
45 }
46
543e4dee 47 protected function tearDown() {
61381e50
TH
48 $this->qtype = null;
49 }
50
51 public function assert_same_xml($expectedxml, $xml) {
543e4dee 52 $this->assertEquals(str_replace("\r\n", "\n", $expectedxml),
61381e50
TH
53 str_replace("\r\n", "\n", $xml));
54 }
55
56 /**
8bc1d28b
EM
57 * Get some test question data.
58 *
61381e50 59 * @return object the data to construct a question like
6229791a 60 * {@link qtype_ddwtos_test_helper::make_ddwtos_question_fox()}.
61381e50
TH
61 */
62 protected function get_test_question_data() {
63 global $USER;
64
60cbb9ed 65 $dd = new stdClass();
61381e50
TH
66 $dd->id = 0;
67 $dd->category = 0;
f7ecca1c 68 $dd->contextid = 0;
61381e50
TH
69 $dd->parent = 0;
70 $dd->questiontextformat = FORMAT_HTML;
e9cd9902 71 $dd->generalfeedbackformat = FORMAT_HTML;
61381e50
TH
72 $dd->defaultmark = 1;
73 $dd->penalty = 0.3333333;
74 $dd->length = 1;
75 $dd->stamp = make_unique_id_code();
76 $dd->version = make_unique_id_code();
77 $dd->hidden = 0;
78 $dd->timecreated = time();
79 $dd->timemodified = time();
80 $dd->createdby = $USER->id;
81 $dd->modifiedby = $USER->id;
82
83 $dd->name = 'Drag-and-drop words into sentences question';
84 $dd->questiontext = 'The [[1]] brown [[2]] jumped over the [[3]] dog.';
85 $dd->generalfeedback = 'This sentence uses each letter of the alphabet.';
86 $dd->qtype = 'ddwtos';
87
543e4dee 88 $dd->options = new stdClass();
61381e50
TH
89 $dd->options->shuffleanswers = true;
90
91 test_question_maker::set_standard_combined_feedback_fields($dd->options);
92
93 $dd->options->answers = array(
29929b5b
TH
94 (object) array('answer' => 'quick', 'feedback' =>
95 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
96 (object) array('answer' => 'fox', 'feedback' =>
97 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
98 (object) array('answer' => 'lazy', 'feedback' =>
99 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
100 (object) array('answer' => 'assiduous', 'feedback' =>
101 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
102 (object) array('answer' => 'dog', 'feedback' =>
103 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
104 (object) array('answer' => 'slow', 'feedback' =>
105 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
61381e50
TH
106 );
107
108 return $dd;
109 }
110
111 public function test_name() {
543e4dee 112 $this->assertEquals($this->qtype->name(), 'ddwtos');
61381e50
TH
113 }
114
115 public function test_can_analyse_responses() {
116 $this->assertTrue($this->qtype->can_analyse_responses());
117 }
118
119 public function test_initialise_question_instance() {
120 $qdata = $this->get_test_question_data();
121
6229791a 122 $expected = test_question_maker::make_question('ddwtos');
61381e50
TH
123 $expected->stamp = $qdata->stamp;
124 $expected->version = $qdata->version;
125
126 $q = $this->qtype->make_question($qdata);
127
543e4dee 128 $this->assertEquals($expected, $q);
61381e50
TH
129 }
130
131 public function test_get_random_guess_score() {
132 $q = $this->get_test_question_data();
543e4dee 133 $this->assertEquals(0.5, $this->qtype->get_random_guess_score($q), '', 0.0000001);
61381e50
TH
134 }
135
136 public function test_get_possible_responses() {
137 $q = $this->get_test_question_data();
138
543e4dee 139 $this->assertEquals(array(
61381e50 140 1 => array(
a9c32a6f 141 1 => new question_possible_response('quick', 1 / 3),
61381e50
TH
142 2 => new question_possible_response('slow', 0),
143 null => question_possible_response::no_response()),
144 2 => array(
a9c32a6f 145 1 => new question_possible_response('fox', 1 / 3),
61381e50
TH
146 2 => new question_possible_response('dog', 0),
147 null => question_possible_response::no_response()),
148 3 => array(
a9c32a6f 149 1 => new question_possible_response('lazy', 1 / 3),
61381e50
TH
150 2 => new question_possible_response('assiduous', 0),
151 null => question_possible_response::no_response()),
152 ), $this->qtype->get_possible_responses($q));
153 }
154
155 public function test_xml_import() {
156 $xml = ' <question type="ddwtos">
157 <name>
158 <text>A drag-and-drop question</text>
159 </name>
160 <questiontext format="moodle_auto_format">
161 <text>Put these in order: [[1]], [[2]], [[3]].</text>
162 </questiontext>
163 <generalfeedback>
164 <text>The answer is Alpha, Beta, Gamma.</text>
165 </generalfeedback>
166 <defaultgrade>3</defaultgrade>
167 <penalty>0.3333333</penalty>
168 <hidden>0</hidden>
169 <shuffleanswers>1</shuffleanswers>
170 <correctfeedback>
171 <text><![CDATA[<p>Your answer is correct.</p>]]></text>
172 </correctfeedback>
173 <partiallycorrectfeedback>
174 <text><![CDATA[<p>Your answer is partially correct.</p>]]></text>
175 </partiallycorrectfeedback>
176 <incorrectfeedback>
177 <text><![CDATA[<p>Your answer is incorrect.</p>]]></text>
178 </incorrectfeedback>
179 <shownumcorrect/>
180 <dragbox>
181 <text>Alpha</text>
182 <group>1</group>
183 </dragbox>
184 <dragbox>
185 <text>Beta</text>
186 <group>1</group>
187 </dragbox>
188 <dragbox>
189 <text>Gamma</text>
190 <group>1</group>
191 <infinite/>
192 </dragbox>
193 <hint>
194 <text>Try again.</text>
195 <shownumcorrect />
196 </hint>
197 <hint>
198 <text>These are the first three letters of the Greek alphabet.</text>
199 <shownumcorrect />
200 <clearwrong />
201 </hint>
202 </question>';
203 $xmldata = xmlize($xml);
204
205 $importer = new qformat_xml();
206 $q = $importer->try_importing_using_qtypes(
207 $xmldata['question'], null, null, 'ddwtos');
208
60cbb9ed 209 $expectedq = new stdClass();
61381e50
TH
210 $expectedq->qtype = 'ddwtos';
211 $expectedq->name = 'A drag-and-drop question';
212 $expectedq->questiontext = 'Put these in order: [[1]], [[2]], [[3]].';
213 $expectedq->questiontextformat = FORMAT_MOODLE;
214 $expectedq->generalfeedback = 'The answer is Alpha, Beta, Gamma.';
215 $expectedq->defaultmark = 3;
216 $expectedq->length = 1;
217 $expectedq->penalty = 0.3333333;
218
219 $expectedq->shuffleanswers = 1;
29929b5b 220 $expectedq->correctfeedback = array('text' => '<p>Your answer is correct.</p>',
1a3cd05d 221 'format' => FORMAT_MOODLE);
29929b5b
TH
222 $expectedq->partiallycorrectfeedback = array(
223 'text' => '<p>Your answer is partially correct.</p>',
1a3cd05d 224 'format' => FORMAT_MOODLE);
61381e50 225 $expectedq->shownumcorrect = true;
29929b5b 226 $expectedq->incorrectfeedback = array('text' => '<p>Your answer is incorrect.</p>',
1a3cd05d 227 'format' => FORMAT_MOODLE);
61381e50
TH
228
229 $expectedq->choices = array(
0234ddc8
TH
230 array('answer' => 'Alpha', 'choicegroup' => 1, 'infinite' => false),
231 array('answer' => 'Beta', 'choicegroup' => 1, 'infinite' => false),
232 array('answer' => 'Gamma', 'choicegroup' => 1, 'infinite' => true),
61381e50
TH
233 );
234
0234ddc8 235 $expectedq->hint = array(
1a3cd05d 236 array('text' => 'Try again.', 'format' => FORMAT_MOODLE),
29929b5b 237 array('text' => 'These are the first three letters of the Greek alphabet.',
1a3cd05d 238 'format' => FORMAT_MOODLE));
61381e50
TH
239 $expectedq->hintshownumcorrect = array(true, true);
240 $expectedq->hintclearwrong = array(false, true);
241
543e4dee
JP
242 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
243 $this->assertEquals($expectedq->hint, $q->hint);
61381e50
TH
244 }
245
246 public function test_xml_import_legacy() {
247 $xml = ' <question type="ddwtos">
248 <name>
249 <text>QDandD1 Base definition</text>
250 </name>
251 <questiontext format="html">
29929b5b
TH
252 <text>&lt;p&gt;Drag and drop the words from the list below to fill the blank spaces ' .
253 'and correctly complete the sentence.&lt;/p&gt; &lt;p&gt;At 25°C all aqueous basic ' .
254 'solutions have [[1]]&#160;ion concentrations less than [[8]]&lt;br /&gt;mol ' .
255 'litre&lt;sup&gt;-1&lt;/sup&gt; and pH values [[9]] than [[6]].&lt;/p&gt; ' .
256 '&lt;!--DONOTCLEAN--&gt;</text>
61381e50
TH
257 </questiontext>
258 <image></image>
259 <generalfeedback>
29929b5b
TH
260 <text>&lt;p&gt;At 25 &amp;#xB0;C all aqueous basic solutions have hydrogen ion ' .
261 'concentrations less than 10&lt;sup&gt;&amp;#x2212;7&lt;/sup&gt; mol ' .
262 'litre&lt;sup&gt;&amp;#x2212;1&lt;/sup&gt; and pH values greater than 7.&lt;/p&gt; ' .
263 '&lt;p&gt;See Section 9 of S103 &lt;em class="italic"&gt;Discovering ' .
264 'Science&lt;/em&gt; Block 8.&lt;/p&gt;</text>
61381e50
TH
265 </generalfeedback>
266 <defaultgrade>1</defaultgrade>
267 <penalty>0.33</penalty>
268 <hidden>0</hidden>
269 <shuffleanswers>0</shuffleanswers>
270 <shuffleanswers>false</shuffleanswers>
271 <answer>
272 <correctanswer>1</correctanswer>
273 <text>hydrogen</text>
274 <feedback>
275 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}</text>
276 </feedback>
277 </answer>
278 <answer>
279 <correctanswer>0</correctanswer>
280 <text>positive</text>
281 <feedback>
282 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}</text>
283 </feedback>
284 </answer>
285 <answer>
286 <correctanswer>0</correctanswer>
287 <text>hydroxide</text>
288 <feedback>
289 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}</text>
290 </feedback>
291 </answer>
292 <answer>
293 <correctanswer>0</correctanswer>
294 <text>negative</text>
295 <feedback>
296 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}</text>
297 </feedback>
298 </answer>
299 <answer>
300 <correctanswer>0</correctanswer>
301 <text>10&lt;sup&gt;7&lt;/sup&gt;</text>
302 <feedback>
303 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}</text>
304 </feedback>
305 </answer>
306 <answer>
307 <correctanswer>1</correctanswer>
308 <text>7</text>
309 <feedback>
310 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}</text>
311 </feedback>
312 </answer>
313 <answer>
314 <correctanswer>0</correctanswer>
315 <text>1</text>
316 <feedback>
317 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}</text>
318 </feedback>
319 </answer>
320 <answer>
321 <correctanswer>1</correctanswer>
322 <text>10&lt;sup&gt;-7&lt;/sup&gt;</text>
323 <feedback>
324 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}</text>
325 </feedback>
326 </answer>
327 <answer>
328 <correctanswer>1</correctanswer>
329 <text>greater</text>
330 <feedback>
331 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}</text>
332 </feedback>
333 </answer>
334 <answer>
335 <correctanswer>0</correctanswer>
336 <text>less</text>
337 <feedback>
338 <text>O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}</text>
339 </feedback>
340 </answer>
341 <correctfeedback>
342 <text>Your answer is correct.</text>
343 </correctfeedback>
344 <correctresponsesfeedback>1</correctresponsesfeedback>
345 <partiallycorrectfeedback>
346 <text>Your answer is partially correct.</text>
347 </partiallycorrectfeedback>
348 <incorrectfeedback>
349 <text>Your answer is incorrect.</text>
350 </incorrectfeedback>
351 <unlimited>0</unlimited>
352 <penalty>0.33</penalty>
353 <hint>
354 <statenumberofcorrectresponses>1</statenumberofcorrectresponses>
355 <clearincorrectresponses>0</clearincorrectresponses>
356 <hintcontent>
29929b5b
TH
357 <text>You may wish to read&#160;Section 9 of&#160;&lt;em ' .
358 'class="italic"&gt;Discovering Science&lt;/em&gt; Block 8.</text>
61381e50
TH
359 </hintcontent>
360 </hint>
361 <hint>
362 <statenumberofcorrectresponses>1</statenumberofcorrectresponses>
363 <clearincorrectresponses>1</clearincorrectresponses>
364 <hintcontent>
365 <text>Any incorrect choices&#160;will be removed before your final try.</text>
366 </hintcontent>
367 </hint>
368 </question>';
369 $xmldata = xmlize($xml);
370
371 $importer = new qformat_xml();
372 $q = $importer->try_importing_using_qtypes(
373 $xmldata['question'], null, null, 'ddwtos');
374
60cbb9ed 375 $expectedq = new stdClass();
61381e50
TH
376 $expectedq->qtype = 'ddwtos';
377 $expectedq->name = 'QDandD1 Base definition';
29929b5b
TH
378 $expectedq->questiontext = '<p>Drag and drop the words from the list below ' .
379 'to fill the blank spaces and correctly complete the sentence.</p>' .
380 '<p>At 25°C all aqueous basic solutions have [[1]] ion concentrations ' .
381 'less than [[8]]<br />mol litre<sup>-1</sup> and pH values [[9]] than [[6]].</p>' .
382 '<!--DONOTCLEAN-->';
61381e50 383 $expectedq->questiontextformat = FORMAT_HTML;
29929b5b
TH
384 $expectedq->generalfeedback = '<p>At 25 &#xB0;C all aqueous basic solutions ' .
385 'have hydrogen ion concentrations less than 10<sup>&#x2212;7</sup> ' .
386 'mol litre<sup>&#x2212;1</sup> and pH values greater than 7.</p><p>See ' .
387 'Section 9 of S103 <em class="italic">Discovering Science</em> Block 8.</p>';
61381e50
TH
388 $expectedq->defaultmark = 1;
389 $expectedq->length = 1;
390 $expectedq->penalty = 0.3333333;
391
392 $expectedq->shuffleanswers = 0;
29929b5b 393 $expectedq->correctfeedback = array('text' => 'Your answer is correct.',
1a3cd05d 394 'format' => FORMAT_HTML);
29929b5b
TH
395 $expectedq->partiallycorrectfeedback = array(
396 'text' => 'Your answer is partially correct.',
1a3cd05d 397 'format' => FORMAT_HTML);
61381e50 398 $expectedq->shownumcorrect = true;
29929b5b 399 $expectedq->incorrectfeedback = array('text' => 'Your answer is incorrect.',
1a3cd05d 400 'format' => FORMAT_HTML);
61381e50
TH
401
402 $expectedq->choices = array(
efff972a 403 array('answer' => array('text' => 'hydrogen', 'format' => FORMAT_PLAIN),
fd670f53 404 'choicegroup' => 1, 'infinite' => false),
efff972a 405 array('answer' => array('text' => 'positive', 'format' => FORMAT_PLAIN),
fd670f53 406 'choicegroup' => 1, 'infinite' => false),
efff972a 407 array('answer' => array('text' => 'hydroxide', 'format' => FORMAT_PLAIN),
fd670f53 408 'choicegroup' => 1, 'infinite' => false),
efff972a 409 array('answer' => array('text' => 'negative', 'format' => FORMAT_PLAIN),
fd670f53 410 'choicegroup' => 1, 'infinite' => false),
efff972a 411 array('answer' => array('text' => '10<sup>7</sup>', 'format' => FORMAT_PLAIN),
fd670f53 412 'choicegroup' => 2, 'infinite' => false),
efff972a 413 array('answer' => array('text' => '7', 'format' => FORMAT_PLAIN),
fd670f53 414 'choicegroup' => 2, 'infinite' => false),
efff972a 415 array('answer' => array('text' => '1', 'format' => FORMAT_PLAIN),
fd670f53 416 'choicegroup' => 2, 'infinite' => false),
efff972a 417 array('answer' => array('text' => '10<sup>-7</sup>', 'format' => FORMAT_PLAIN),
fd670f53 418 'choicegroup' => 2, 'infinite' => false),
efff972a 419 array('answer' => array('text' => 'greater', 'format' => FORMAT_PLAIN),
fd670f53 420 'choicegroup' => 3, 'infinite' => false),
efff972a 421 array('answer' => array('text' => 'less', 'format' => FORMAT_PLAIN),
fd670f53 422 'choicegroup' => 3, 'infinite' => false),
61381e50
TH
423 );
424
29929b5b
TH
425 $expectedq->hint = array(array('text' => 'You may wish to read Section 9 of ' .
426 '<em class="italic">Discovering Science</em> Block 8.',
1a3cd05d 427 'format' => FORMAT_HTML),
29929b5b 428 array('text' => 'Any incorrect choices will be removed before your final try.',
1a3cd05d 429 'format' => FORMAT_HTML),
61381e50
TH
430 );
431 $expectedq->hintshownumcorrect = array(true, true);
432 $expectedq->hintclearwrong = array(false, true);
433
543e4dee
JP
434 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
435 $this->assertEquals($expectedq->choices, $q->choices);
436 $this->assertEquals($expectedq->hint, $q->hint);
61381e50
TH
437 }
438
439 public function test_xml_export() {
60cbb9ed 440 $qdata = new stdClass();
61381e50 441 $qdata->id = 123;
1796eb18 442 $qdata->contextid = \context_system::instance()->id;
61381e50
TH
443 $qdata->qtype = 'ddwtos';
444 $qdata->name = 'A drag-and-drop question';
445 $qdata->questiontext = 'Put these in order: [[1]], [[2]], [[3]].';
446 $qdata->questiontextformat = FORMAT_MOODLE;
447 $qdata->generalfeedback = 'The answer is Alpha, Beta, Gamma.';
e9cd9902 448 $qdata->generalfeedbackformat = FORMAT_MOODLE;
61381e50
TH
449 $qdata->defaultmark = 3;
450 $qdata->length = 1;
451 $qdata->penalty = 0.3333333;
452 $qdata->hidden = 0;
453
543e4dee 454 $qdata->options = new stdClass();
61381e50
TH
455 $qdata->options->shuffleanswers = 1;
456 $qdata->options->correctfeedback = '<p>Your answer is correct.</p>';
e9cd9902 457 $qdata->options->correctfeedbackformat = FORMAT_MOODLE;
61381e50 458 $qdata->options->partiallycorrectfeedback = '<p>Your answer is partially correct.</p>';
e9cd9902
TH
459 $qdata->options->partiallycorrectfeedbackformat = FORMAT_MOODLE;
460 $qdata->options->shownumcorrect = 1;
61381e50 461 $qdata->options->incorrectfeedback = '<p>Your answer is incorrect.</p>';
e9cd9902 462 $qdata->options->incorrectfeedbackformat = FORMAT_MOODLE;
61381e50
TH
463
464 $qdata->options->answers = array(
29929b5b
TH
465 13 => new question_answer(13, 'Alpha', 0,
466 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}',
467 FORMAT_MOODLE),
468 14 => new question_answer(14, 'Beta', 0,
469 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}',
470 FORMAT_MOODLE),
471 15 => new question_answer(15, 'Gamma', 0,
472 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:1;}',
473 FORMAT_MOODLE),
61381e50
TH
474 );
475
476 $qdata->hints = array(
e9cd9902 477 1 => new question_hint_with_parts(1, 'Try again.', FORMAT_MOODLE, true, false),
29929b5b
TH
478 2 => new question_hint_with_parts(2,
479 'These are the first three letters of the Greek alphabet.',
480 FORMAT_MOODLE, true, true),
61381e50
TH
481 );
482
483 $exporter = new qformat_xml();
484 $xml = $exporter->writequestion($qdata);
485
486 $expectedxml = '<!-- question: 123 -->
487 <question type="ddwtos">
488 <name>
489 <text>A drag-and-drop question</text>
490 </name>
491 <questiontext format="moodle_auto_format">
492 <text>Put these in order: [[1]], [[2]], [[3]].</text>
493 </questiontext>
e9cd9902 494 <generalfeedback format="moodle_auto_format">
61381e50
TH
495 <text>The answer is Alpha, Beta, Gamma.</text>
496 </generalfeedback>
497 <defaultgrade>3</defaultgrade>
498 <penalty>0.3333333</penalty>
499 <hidden>0</hidden>
500 <shuffleanswers>1</shuffleanswers>
e9cd9902 501 <correctfeedback format="moodle_auto_format">
61381e50
TH
502 <text><![CDATA[<p>Your answer is correct.</p>]]></text>
503 </correctfeedback>
e9cd9902 504 <partiallycorrectfeedback format="moodle_auto_format">
61381e50
TH
505 <text><![CDATA[<p>Your answer is partially correct.</p>]]></text>
506 </partiallycorrectfeedback>
e9cd9902 507 <incorrectfeedback format="moodle_auto_format">
61381e50
TH
508 <text><![CDATA[<p>Your answer is incorrect.</p>]]></text>
509 </incorrectfeedback>
510 <shownumcorrect/>
511 <dragbox>
512 <text>Alpha</text>
513 <group>1</group>
514 </dragbox>
515 <dragbox>
516 <text>Beta</text>
517 <group>1</group>
518 </dragbox>
519 <dragbox>
520 <text>Gamma</text>
521 <group>1</group>
522 <infinite/>
523 </dragbox>
e9cd9902 524 <hint format="moodle_auto_format">
61381e50
TH
525 <text>Try again.</text>
526 <shownumcorrect/>
527 </hint>
e9cd9902 528 <hint format="moodle_auto_format">
61381e50
TH
529 <text>These are the first three letters of the Greek alphabet.</text>
530 <shownumcorrect/>
531 <clearwrong/>
532 </hint>
533 </question>
534';
535
536 $this->assert_same_xml($expectedxml, $xml);
537 }
538}