@@ -243,199 +243,6 @@ public function test_xml_import() {
243
243
$ this ->assertEquals ($ expectedq ->hint , $ q ->hint );
244
244
}
245
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">
252
- <text><p>Drag and drop the words from the list below to fill the blank spaces ' .
253
- 'and correctly complete the sentence.</p> <p>At 25°C all aqueous basic ' .
254
- 'solutions have [[1]] ion concentrations less than [[8]]<br />mol ' .
255
- 'litre<sup>-1</sup> and pH values [[9]] than [[6]].</p> ' .
256
- '<!--DONOTCLEAN--></text>
257
- </questiontext>
258
- <image></image>
259
- <generalfeedback>
260
- <text><p>At 25 &#xB0;C all aqueous basic solutions have hydrogen ion ' .
261
- 'concentrations less than 10<sup>&#x2212;7</sup> mol ' .
262
- 'litre<sup>&#x2212;1</sup> and pH values greater than 7.</p> ' .
263
- '<p>See Section 9 of S103 <em class="italic">Discovering ' .
264
- 'Science</em> Block 8.</p></text>
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<sup>7</sup></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<sup>-7</sup></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>
357
- <text>You may wish to read Section 9 of <em ' .
358
- 'class="italic">Discovering Science</em> Block 8.</text>
359
- </hintcontent>
360
- </hint>
361
- <hint>
362
- <statenumberofcorrectresponses>1</statenumberofcorrectresponses>
363
- <clearincorrectresponses>1</clearincorrectresponses>
364
- <hintcontent>
365
- <text>Any incorrect choices 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
-
375
- $ expectedq = new stdClass ();
376
- $ expectedq ->qtype = 'ddwtos ' ;
377
- $ expectedq ->name = 'QDandD1 Base definition ' ;
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--> ' ;
383
- $ expectedq ->questiontextformat = FORMAT_HTML ;
384
- $ expectedq ->generalfeedback = '<p>At 25 °C all aqueous basic solutions ' .
385
- 'have hydrogen ion concentrations less than 10<sup>−7</sup> ' .
386
- 'mol litre<sup>−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> ' ;
388
- $ expectedq ->defaultmark = 1 ;
389
- $ expectedq ->length = 1 ;
390
- $ expectedq ->penalty = 0.3333333 ;
391
-
392
- $ expectedq ->shuffleanswers = 0 ;
393
- $ expectedq ->correctfeedback = array ('text ' => 'Your answer is correct. ' ,
394
- 'format ' => FORMAT_HTML );
395
- $ expectedq ->partiallycorrectfeedback = array (
396
- 'text ' => 'Your answer is partially correct. ' ,
397
- 'format ' => FORMAT_HTML );
398
- $ expectedq ->shownumcorrect = true ;
399
- $ expectedq ->incorrectfeedback = array ('text ' => 'Your answer is incorrect. ' ,
400
- 'format ' => FORMAT_HTML );
401
-
402
- $ expectedq ->choices = array (
403
- array ('answer ' => array ('text ' => 'hydrogen ' , 'format ' => FORMAT_PLAIN ),
404
- 'choicegroup ' => 1 , 'infinite ' => false ),
405
- array ('answer ' => array ('text ' => 'positive ' , 'format ' => FORMAT_PLAIN ),
406
- 'choicegroup ' => 1 , 'infinite ' => false ),
407
- array ('answer ' => array ('text ' => 'hydroxide ' , 'format ' => FORMAT_PLAIN ),
408
- 'choicegroup ' => 1 , 'infinite ' => false ),
409
- array ('answer ' => array ('text ' => 'negative ' , 'format ' => FORMAT_PLAIN ),
410
- 'choicegroup ' => 1 , 'infinite ' => false ),
411
- array ('answer ' => array ('text ' => '10<sup>7</sup> ' , 'format ' => FORMAT_PLAIN ),
412
- 'choicegroup ' => 2 , 'infinite ' => false ),
413
- array ('answer ' => array ('text ' => '7 ' , 'format ' => FORMAT_PLAIN ),
414
- 'choicegroup ' => 2 , 'infinite ' => false ),
415
- array ('answer ' => array ('text ' => '1 ' , 'format ' => FORMAT_PLAIN ),
416
- 'choicegroup ' => 2 , 'infinite ' => false ),
417
- array ('answer ' => array ('text ' => '10<sup>-7</sup> ' , 'format ' => FORMAT_PLAIN ),
418
- 'choicegroup ' => 2 , 'infinite ' => false ),
419
- array ('answer ' => array ('text ' => 'greater ' , 'format ' => FORMAT_PLAIN ),
420
- 'choicegroup ' => 3 , 'infinite ' => false ),
421
- array ('answer ' => array ('text ' => 'less ' , 'format ' => FORMAT_PLAIN ),
422
- 'choicegroup ' => 3 , 'infinite ' => false ),
423
- );
424
-
425
- $ expectedq ->hint = array (array ('text ' => 'You may wish to read Section 9 of ' .
426
- '<em class="italic">Discovering Science</em> Block 8. ' ,
427
- 'format ' => FORMAT_HTML ),
428
- array ('text ' => 'Any incorrect choices will be removed before your final try. ' ,
429
- 'format ' => FORMAT_HTML ),
430
- );
431
- $ expectedq ->hintshownumcorrect = array (true , true );
432
- $ expectedq ->hintclearwrong = array (false , true );
433
-
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 );
437
- }
438
-
439
246
public function test_xml_export () {
440
247
$ qdata = new stdClass ();
441
248
$ qdata ->id = 123 ;
0 commit comments