mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 11:26:41 +02:00
MDL-47494 ddwtos: Fix codechecker problems in match, description and ddwtos qtypes.
This commit is contained in:
parent
092c416ebc
commit
29929b5b2c
9 changed files with 270 additions and 225 deletions
|
@ -50,7 +50,6 @@ class restore_qtype_ddwtos_plugin extends restore_qtype_plugin {
|
||||||
$elepath = $this->get_pathfor('/ddwtos'); // we used get_recommended_name() so this works
|
$elepath = $this->get_pathfor('/ddwtos'); // we used get_recommended_name() so this works
|
||||||
$paths[] = new restore_path_element($elename, $elepath);
|
$paths[] = new restore_path_element($elename, $elepath);
|
||||||
|
|
||||||
|
|
||||||
return $paths; // And we return the interesting paths
|
return $paths; // And we return the interesting paths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,8 +75,6 @@ class restore_qtype_ddwtos_plugin extends restore_qtype_plugin {
|
||||||
$newitemid = $DB->insert_record('question_ddwtos', $data);
|
$newitemid = $DB->insert_record('question_ddwtos', $data);
|
||||||
// Create mapping (needed for decoding links)
|
// Create mapping (needed for decoding links)
|
||||||
$this->set_mapping('question_ddwtos', $oldid, $newitemid);
|
$this->set_mapping('question_ddwtos', $oldid, $newitemid);
|
||||||
} else {
|
|
||||||
// Nothing to remap if the question already existed
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ class qtype_ddwtos_edit_form extends qtype_gapselect_edit_form_base {
|
||||||
|
|
||||||
protected function choice_group($mform) {
|
protected function choice_group($mform) {
|
||||||
$grouparray = parent::choice_group($mform);
|
$grouparray = parent::choice_group($mform);
|
||||||
$grouparray[] = $mform->createElement('checkbox', 'infinite', ' ', get_string('infinite', 'qtype_ddwtos'), null, array('size'=>1, 'class'=>'tweakcss'));
|
$grouparray[] = $mform->createElement('checkbox', 'infinite', ' ',
|
||||||
|
get_string('infinite', 'qtype_ddwtos'), null,
|
||||||
|
array('size' => 1, 'class' => 'tweakcss'));
|
||||||
return $grouparray;
|
return $grouparray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class qtype_ddwtos_choice {
|
||||||
$this->draggroup = $draggroup;
|
$this->draggroup = $draggroup;
|
||||||
$this->isinfinite = $isinfinite;
|
$this->isinfinite = $isinfinite;
|
||||||
}
|
}
|
||||||
public function choice_group(){
|
public function choice_group() {
|
||||||
return $this->draggroup;
|
return $this->draggroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ require_once($CFG->dirroot . '/question/type/gapselect/questiontypebase.php');
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
class qtype_ddwtos extends qtype_gapselect_base {
|
class qtype_ddwtos extends qtype_gapselect_base {
|
||||||
protected function choice_group_key(){
|
protected function choice_group_key() {
|
||||||
return 'draggroup';
|
return 'draggroup';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,21 +48,22 @@ class qtype_ddwtos extends qtype_gapselect_base {
|
||||||
return array('gapselect');
|
return array('gapselect');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function choice_options_to_feedback($choice){
|
protected function choice_options_to_feedback($choice) {
|
||||||
$output = new stdClass();
|
$output = new stdClass();
|
||||||
$output->draggroup = $choice['choicegroup'];
|
$output->draggroup = $choice['choicegroup'];
|
||||||
$output->infinite = !empty($choice['infinite']);
|
$output->infinite = !empty($choice['infinite']);
|
||||||
return serialize($output);
|
return serialize($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function feedback_to_choice_options($feedback){
|
protected function feedback_to_choice_options($feedback) {
|
||||||
$feedbackobj = unserialize($feedback);
|
$feedbackobj = unserialize($feedback);
|
||||||
return array('draggroup'=> $feedbackobj->draggroup, 'infinite'=> $feedbackobj->infinite);
|
return array('draggroup' => $feedbackobj->draggroup, 'infinite' => $feedbackobj->infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function make_choice($choicedata){
|
protected function make_choice($choicedata) {
|
||||||
$options = unserialize($choicedata->feedback);
|
$options = unserialize($choicedata->feedback);
|
||||||
return new qtype_ddwtos_choice($choicedata->answer, $options->draggroup, $options->infinite);
|
return new qtype_ddwtos_choice(
|
||||||
|
$choicedata->answer, $options->draggroup, $options->infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function import_from_xml($data, $question, $format, $extra=null) {
|
public function import_from_xml($data, $question, $format, $extra=null) {
|
||||||
|
@ -113,7 +114,8 @@ class qtype_ddwtos extends qtype_gapselect_base {
|
||||||
public function export_to_xml($question, $format, $extra = null) {
|
public function export_to_xml($question, $format, $extra = null) {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$output .= ' <shuffleanswers>' . $question->options->shuffleanswers . "</shuffleanswers>\n";
|
$output .= ' <shuffleanswers>' . $question->options->shuffleanswers .
|
||||||
|
"</shuffleanswers>\n";
|
||||||
|
|
||||||
$output .= $format->write_combined_feedback($question->options);
|
$output .= $format->write_combined_feedback($question->options);
|
||||||
|
|
||||||
|
@ -131,95 +133,4 @@ class qtype_ddwtos extends qtype_gapselect_base {
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Backup the data in the question
|
|
||||||
*
|
|
||||||
* This is used in question/backuplib.php
|
|
||||||
*/
|
|
||||||
public function backup($bf, $preferences, $question, $level = 6) {
|
|
||||||
$status = true;
|
|
||||||
$ddwtos = get_records("question_ddwtos", "questionid", $question, "id");
|
|
||||||
|
|
||||||
//If there are ddwtos
|
|
||||||
if ($ddwtos) {
|
|
||||||
//Iterate over each ddwtos
|
|
||||||
foreach ($ddwtos as $ddws) {
|
|
||||||
$status = fwrite ($bf,start_tag("DDWORDSSENTENCES",$level,true));
|
|
||||||
//Print oumultiresponse contents
|
|
||||||
fwrite ($bf,full_tag("SHUFFLEANSWERS",$level+1,false,$ddws->shuffleanswers));
|
|
||||||
fwrite ($bf,full_tag("CORRECTFEEDBACK",$level+1,false,$ddws->correctfeedback));
|
|
||||||
fwrite ($bf,full_tag("PARTIALLYCORRECTFEEDBACK",$level+1,false,$ddws->partiallycorrectfeedback));
|
|
||||||
fwrite ($bf,full_tag("INCORRECTFEEDBACK",$level+1,false,$ddws->incorrectfeedback));
|
|
||||||
fwrite ($bf,full_tag("SHOWNUMCORRECT",$level+1,false,$ddws->shownumcorrect));
|
|
||||||
$status = fwrite ($bf,end_tag("DDWORDSSENTENCES",$level,true));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Now print question_answers
|
|
||||||
$status = question_backup_answers($bf,$preferences,$question);
|
|
||||||
}
|
|
||||||
return $status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores the data in the question (This is used in question/restorelib.php)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function restore($old_question_id,$new_question_id,$info,$restore) {
|
|
||||||
$status = true;
|
|
||||||
|
|
||||||
//Get the ddwtos array
|
|
||||||
$ddwtos = $info['#']['DDWORDSSENTENCES'];
|
|
||||||
|
|
||||||
//Iterate over oumultiresponses
|
|
||||||
for($i = 0; $i < sizeof($ddwtos); $i++) {
|
|
||||||
$mul_info = $ddwtos[$i];
|
|
||||||
|
|
||||||
//Now, build the question_ddwtos record structure
|
|
||||||
$ddwtos = new stdClass();
|
|
||||||
$ddwtos->questionid = $new_question_id;
|
|
||||||
$ddwtos->shuffleanswers = isset($mul_info['#']['SHUFFLEANSWERS']['0']['#'])?backup_todb($mul_info['#']['SHUFFLEANSWERS']['0']['#']):'';
|
|
||||||
if (array_key_exists("CORRECTFEEDBACK", $mul_info['#'])) {
|
|
||||||
$ddwtos->correctfeedback = backup_todb($mul_info['#']['CORRECTFEEDBACK']['0']['#']);
|
|
||||||
} else {
|
|
||||||
$ddwtos->correctfeedback = '';
|
|
||||||
}
|
|
||||||
if (array_key_exists("PARTIALLYCORRECTFEEDBACK", $mul_info['#'])) {
|
|
||||||
$ddwtos->partiallycorrectfeedback = backup_todb($mul_info['#']['PARTIALLYCORRECTFEEDBACK']['0']['#']);
|
|
||||||
} else {
|
|
||||||
$ddwtos->partiallycorrectfeedback = '';
|
|
||||||
}
|
|
||||||
if (array_key_exists("INCORRECTFEEDBACK", $mul_info['#'])) {
|
|
||||||
$ddwtos->incorrectfeedback = backup_todb($mul_info['#']['INCORRECTFEEDBACK']['0']['#']);
|
|
||||||
} else {
|
|
||||||
$ddwtos->incorrectfeedback = '';
|
|
||||||
}
|
|
||||||
if (array_key_exists('SHOWNUMCORRECT', $mul_info['#'])) {
|
|
||||||
$ddwtos->shownumcorrect = backup_todb($mul_info['#']['SHOWNUMCORRECT']['0']['#']);
|
|
||||||
} else if (array_key_exists('CORRECTRESPONSESFEEDBACK', $mul_info['#'])) {
|
|
||||||
$ddwtos->shownumcorrect = backup_todb($mul_info['#']['CORRECTRESPONSESFEEDBACK']['0']['#']);
|
|
||||||
} else {
|
|
||||||
$ddwtos->shownumcorrect = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$newid = insert_record ("question_ddwtos",$ddwtos);
|
|
||||||
|
|
||||||
//Do some output
|
|
||||||
if (($i+1) % 50 == 0) {
|
|
||||||
if (!defined('RESTORE_SILENTLY')) {
|
|
||||||
echo ".";
|
|
||||||
if (($i+1) % 1000 == 0) {
|
|
||||||
echo "<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
backup_flush(300);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$newid) {
|
|
||||||
$status = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $status;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,12 @@ require_once($CFG->dirroot . '/question/type/gapselect/rendererbase.php');
|
||||||
*/
|
*/
|
||||||
class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_renderer {
|
class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_renderer {
|
||||||
|
|
||||||
protected function qtext_classname(){
|
protected function qtext_classname() {
|
||||||
return 'qtext ddwtos_questionid_for_javascript';
|
return 'qtext ddwtos_questionid_for_javascript';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function post_qtext_elements(question_attempt $qa, question_display_options $options){
|
protected function post_qtext_elements(question_attempt $qa,
|
||||||
|
question_display_options $options) {
|
||||||
$result = '';
|
$result = '';
|
||||||
$question = $qa->get_question();
|
$question = $qa->get_question();
|
||||||
$dragboxs = '';
|
$dragboxs = '';
|
||||||
|
@ -71,7 +72,8 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||||
return '<sub> </sub>' . $string . '<sup> </sup>';
|
return '<sub> </sub>' . $string . '<sup> </sup>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function embedded_element(question_attempt $qa, $place, question_display_options $options) {
|
protected function embedded_element(question_attempt $qa, $place,
|
||||||
|
question_display_options $options) {
|
||||||
$question = $qa->get_question();
|
$question = $qa->get_question();
|
||||||
$group = $question->places[$place];
|
$group = $question->places[$place];
|
||||||
$boxcontents = $this->dodgy_ie_fix(' ');
|
$boxcontents = $this->dodgy_ie_fix(' ');
|
||||||
|
@ -94,7 +96,8 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||||
$response = $qa->get_last_qt_data();
|
$response = $qa->get_last_qt_data();
|
||||||
$fieldname = $question->field($place);
|
$fieldname = $question->field($place);
|
||||||
if (array_key_exists($fieldname, $response)) {
|
if (array_key_exists($fieldname, $response)) {
|
||||||
$fraction = (int) ($response[$fieldname] == $question->get_right_choice_for($place));
|
$fraction = (int) ($response[$fieldname] ==
|
||||||
|
$question->get_right_choice_for($place));
|
||||||
$attributes['class'] .= ' ' . $this->feedback_class($fraction);
|
$attributes['class'] .= ' ' . $this->feedback_class($fraction);
|
||||||
$feedbackimage = $this->feedback_image($fraction);
|
$feedbackimage = $this->feedback_image($fraction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ var ddwtos_currentzindex = 10;
|
||||||
initPlayer : function(id, sGroup, config) {
|
initPlayer : function(id, sGroup, config) {
|
||||||
this.isTarget = false;
|
this.isTarget = false;
|
||||||
this.currentPos = YAHOO.util.Dom.getXY(this.getEl());
|
this.currentPos = YAHOO.util.Dom.getXY(this.getEl());
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//Abstract method called after a drag/drop object is clicked and the drag or mousedown time thresholds have beeen met.
|
//Abstract method called after a drag/drop object is clicked and the drag or mousedown time thresholds have beeen met.
|
||||||
|
@ -178,7 +177,6 @@ var ddwtos_currentzindex = 10;
|
||||||
|
|
||||||
YAHOO.util.Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
|
YAHOO.util.Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
|
||||||
|
|
||||||
|
|
||||||
// Objects///////////////////////////////////////////////////////////////////
|
// Objects///////////////////////////////////////////////////////////////////
|
||||||
var Questions = new Object();
|
var Questions = new Object();
|
||||||
|
|
||||||
|
@ -300,7 +298,9 @@ var ddwtos_currentzindex = 10;
|
||||||
var slot = slots[i];
|
var slot = slots[i];
|
||||||
|
|
||||||
var hiddenElement = document.getElementById(slot.id + '_hidden');
|
var hiddenElement = document.getElementById(slot.id + '_hidden');
|
||||||
if (!hiddenElement) continue;
|
if (!hiddenElement) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// get group
|
// get group
|
||||||
var group = getGroupForThis(slot.id);
|
var group = getGroupForThis(slot.id);
|
||||||
|
|
|
@ -41,7 +41,8 @@ class qtype_ddwtos_question_test extends UnitTestCase {
|
||||||
|
|
||||||
public function test_get_question_summary() {
|
public function test_get_question_summary() {
|
||||||
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
||||||
$this->assertEqual('The [[1]] brown [[2]] jumped over the [[3]] dog.; [[1]] -> {quick / slow}; [[2]] -> {fox / dog}; [[3]] -> {lazy / assiduous}',
|
$this->assertEqual('The [[1]] brown [[2]] jumped over the [[3]] dog.; ' .
|
||||||
|
'[[1]] -> {quick / slow}; [[2]] -> {fox / dog}; [[3]] -> {lazy / assiduous}',
|
||||||
$dd->get_question_summary());
|
$dd->get_question_summary());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,8 @@ class qtype_ddwtos_question_test extends UnitTestCase {
|
||||||
$dd->start_attempt(new question_attempt_step());
|
$dd->start_attempt(new question_attempt_step());
|
||||||
|
|
||||||
$this->assertEqual(array(2, 4),
|
$this->assertEqual(array(2, 4),
|
||||||
$dd->get_num_parts_right(array('p1' => '1', 'p2' => '1', 'p3' => '1', 'p4' => '1')));
|
$dd->get_num_parts_right(array(
|
||||||
|
'p1' => '1', 'p2' => '1', 'p3' => '1', 'p4' => '1')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_expected_data() {
|
public function test_get_expected_data() {
|
||||||
|
|
|
@ -89,12 +89,18 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
test_question_maker::set_standard_combined_feedback_fields($dd->options);
|
test_question_maker::set_standard_combined_feedback_fields($dd->options);
|
||||||
|
|
||||||
$dd->options->answers = array(
|
$dd->options->answers = array(
|
||||||
(object) array('answer' => 'quick', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
|
(object) array('answer' => 'quick', 'feedback' =>
|
||||||
(object) array('answer' => 'fox', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
|
||||||
(object) array('answer' => 'lazy', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
|
(object) array('answer' => 'fox', 'feedback' =>
|
||||||
(object) array('answer' => 'assiduous', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
|
||||||
(object) array('answer' => 'dog', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
|
(object) array('answer' => 'lazy', 'feedback' =>
|
||||||
(object) array('answer' => 'slow', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
|
||||||
|
(object) array('answer' => 'assiduous', 'feedback' =>
|
||||||
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'),
|
||||||
|
(object) array('answer' => 'dog', 'feedback' =>
|
||||||
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'),
|
||||||
|
(object) array('answer' => 'slow', 'feedback' =>
|
||||||
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $dd;
|
return $dd;
|
||||||
|
@ -209,10 +215,14 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
$expectedq->penalty = 0.3333333;
|
$expectedq->penalty = 0.3333333;
|
||||||
|
|
||||||
$expectedq->shuffleanswers = 1;
|
$expectedq->shuffleanswers = 1;
|
||||||
$expectedq->correctfeedback = array('text' => '<p>Your answer is correct.</p>', 'format' => FORMAT_MOODLE, 'files' => array());
|
$expectedq->correctfeedback = array('text' => '<p>Your answer is correct.</p>',
|
||||||
$expectedq->partiallycorrectfeedback = array('text' => '<p>Your answer is partially correct.</p>', 'format' => FORMAT_MOODLE, 'files' => array());
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
|
$expectedq->partiallycorrectfeedback = array(
|
||||||
|
'text' => '<p>Your answer is partially correct.</p>',
|
||||||
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
$expectedq->shownumcorrect = true;
|
$expectedq->shownumcorrect = true;
|
||||||
$expectedq->incorrectfeedback = array('text' => '<p>Your answer is incorrect.</p>', 'format' => FORMAT_MOODLE, 'files' => array());
|
$expectedq->incorrectfeedback = array('text' => '<p>Your answer is incorrect.</p>',
|
||||||
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
|
|
||||||
$expectedq->choices = array(
|
$expectedq->choices = array(
|
||||||
array('answer' => 'Alpha', 'choicegroup' => 1, 'infinite' => false),
|
array('answer' => 'Alpha', 'choicegroup' => 1, 'infinite' => false),
|
||||||
|
@ -222,7 +232,8 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
|
|
||||||
$expectedq->hint = array(
|
$expectedq->hint = array(
|
||||||
array('text' => 'Try again.', 'format' => FORMAT_MOODLE, 'files' => array()),
|
array('text' => 'Try again.', 'format' => FORMAT_MOODLE, 'files' => array()),
|
||||||
array('text' => 'These are the first three letters of the Greek alphabet.', 'format' => FORMAT_MOODLE, 'files' => array()));
|
array('text' => 'These are the first three letters of the Greek alphabet.',
|
||||||
|
'format' => FORMAT_MOODLE, 'files' => array()));
|
||||||
$expectedq->hintshownumcorrect = array(true, true);
|
$expectedq->hintshownumcorrect = array(true, true);
|
||||||
$expectedq->hintclearwrong = array(false, true);
|
$expectedq->hintclearwrong = array(false, true);
|
||||||
|
|
||||||
|
@ -235,11 +246,19 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
<text>QDandD1 Base definition</text>
|
<text>QDandD1 Base definition</text>
|
||||||
</name>
|
</name>
|
||||||
<questiontext format="html">
|
<questiontext format="html">
|
||||||
<text><p>Drag and drop the words from the list below to fill the blank spaces and correctly complete the sentence.</p> <p>At 25°C all aqueous basic solutions have [[1]] ion concentrations less than [[8]]<br />mol litre<sup>-1</sup> and pH values [[9]] than [[6]].</p> <!--DONOTCLEAN--></text>
|
<text><p>Drag and drop the words from the list below to fill the blank spaces ' .
|
||||||
|
'and correctly complete the sentence.</p> <p>At 25°C all aqueous basic ' .
|
||||||
|
'solutions have [[1]] ion concentrations less than [[8]]<br />mol ' .
|
||||||
|
'litre<sup>-1</sup> and pH values [[9]] than [[6]].</p> ' .
|
||||||
|
'<!--DONOTCLEAN--></text>
|
||||||
</questiontext>
|
</questiontext>
|
||||||
<image></image>
|
<image></image>
|
||||||
<generalfeedback>
|
<generalfeedback>
|
||||||
<text><p>At 25 &#xB0;C all aqueous basic solutions have hydrogen ion concentrations less than 10<sup>&#x2212;7</sup> mol litre<sup>&#x2212;1</sup> and pH values greater than 7.</p> <p>See Section 9 of S103 <em class="italic">Discovering Science</em> Block 8.</p></text>
|
<text><p>At 25 &#xB0;C all aqueous basic solutions have hydrogen ion ' .
|
||||||
|
'concentrations less than 10<sup>&#x2212;7</sup> mol ' .
|
||||||
|
'litre<sup>&#x2212;1</sup> and pH values greater than 7.</p> ' .
|
||||||
|
'<p>See Section 9 of S103 <em class="italic">Discovering ' .
|
||||||
|
'Science</em> Block 8.</p></text>
|
||||||
</generalfeedback>
|
</generalfeedback>
|
||||||
<defaultgrade>1</defaultgrade>
|
<defaultgrade>1</defaultgrade>
|
||||||
<penalty>0.33</penalty>
|
<penalty>0.33</penalty>
|
||||||
|
@ -332,7 +351,8 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
<statenumberofcorrectresponses>1</statenumberofcorrectresponses>
|
<statenumberofcorrectresponses>1</statenumberofcorrectresponses>
|
||||||
<clearincorrectresponses>0</clearincorrectresponses>
|
<clearincorrectresponses>0</clearincorrectresponses>
|
||||||
<hintcontent>
|
<hintcontent>
|
||||||
<text>You may wish to read Section 9 of <em class="italic">Discovering Science</em> Block 8.</text>
|
<text>You may wish to read Section 9 of <em ' .
|
||||||
|
'class="italic">Discovering Science</em> Block 8.</text>
|
||||||
</hintcontent>
|
</hintcontent>
|
||||||
</hint>
|
</hint>
|
||||||
<hint>
|
<hint>
|
||||||
|
@ -352,36 +372,57 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
$expectedq = new stdClass();
|
$expectedq = new stdClass();
|
||||||
$expectedq->qtype = 'ddwtos';
|
$expectedq->qtype = 'ddwtos';
|
||||||
$expectedq->name = 'QDandD1 Base definition';
|
$expectedq->name = 'QDandD1 Base definition';
|
||||||
$expectedq->questiontext = '<p>Drag and drop the words from the list below to fill the blank spaces and correctly complete the sentence.</p><p>At 25°C all aqueous basic solutions have [[1]] ion concentrations less than [[8]]<br />mol litre<sup>-1</sup> and pH values [[9]] than [[6]].</p><!--DONOTCLEAN-->';
|
$expectedq->questiontext = '<p>Drag and drop the words from the list below ' .
|
||||||
|
'to fill the blank spaces and correctly complete the sentence.</p>' .
|
||||||
|
'<p>At 25°C all aqueous basic solutions have [[1]] ion concentrations ' .
|
||||||
|
'less than [[8]]<br />mol litre<sup>-1</sup> and pH values [[9]] than [[6]].</p>' .
|
||||||
|
'<!--DONOTCLEAN-->';
|
||||||
$expectedq->questiontextformat = FORMAT_HTML;
|
$expectedq->questiontextformat = FORMAT_HTML;
|
||||||
$expectedq->generalfeedback = '<p>At 25 °C all aqueous basic solutions have hydrogen ion concentrations less than 10<sup>−7</sup> mol litre<sup>−1</sup> and pH values greater than 7.</p><p>See Section 9 of S103 <em class="italic">Discovering Science</em> Block 8.</p>';
|
$expectedq->generalfeedback = '<p>At 25 °C all aqueous basic solutions ' .
|
||||||
|
'have hydrogen ion concentrations less than 10<sup>−7</sup> ' .
|
||||||
|
'mol litre<sup>−1</sup> and pH values greater than 7.</p><p>See ' .
|
||||||
|
'Section 9 of S103 <em class="italic">Discovering Science</em> Block 8.</p>';
|
||||||
$expectedq->defaultmark = 1;
|
$expectedq->defaultmark = 1;
|
||||||
$expectedq->length = 1;
|
$expectedq->length = 1;
|
||||||
$expectedq->penalty = 0.3333333;
|
$expectedq->penalty = 0.3333333;
|
||||||
|
|
||||||
$expectedq->shuffleanswers = 0;
|
$expectedq->shuffleanswers = 0;
|
||||||
$expectedq->correctfeedback = array('text' => 'Your answer is correct.', 'format' => FORMAT_MOODLE, 'files' => array());
|
$expectedq->correctfeedback = array('text' => 'Your answer is correct.',
|
||||||
$expectedq->partiallycorrectfeedback = array('text' => 'Your answer is partially correct.', 'format' => FORMAT_MOODLE, 'files' => array());
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
|
$expectedq->partiallycorrectfeedback = array(
|
||||||
|
'text' => 'Your answer is partially correct.',
|
||||||
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
$expectedq->shownumcorrect = true;
|
$expectedq->shownumcorrect = true;
|
||||||
$expectedq->incorrectfeedback = array('text' => 'Your answer is incorrect.', 'format' => FORMAT_MOODLE, 'files' => array());
|
$expectedq->incorrectfeedback = array('text' => 'Your answer is incorrect.',
|
||||||
|
'format' => FORMAT_MOODLE, 'files' => array());
|
||||||
|
|
||||||
$expectedq->choices = array(
|
$expectedq->choices = array(
|
||||||
array('answer' => array('text' => 'hydrogen', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
array('answer' => array('text' => 'hydrogen', 'format' => FORMAT_MOODLE,
|
||||||
array('answer' => array('text' => 'positive', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
||||||
array('answer' => array('text' => 'hydroxide', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
array('answer' => array('text' => 'positive', 'format' => FORMAT_MOODLE,
|
||||||
array('answer' => array('text' => 'negative', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
||||||
array('answer' => array('text' => '10<sup>7</sup>', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
array('answer' => array('text' => 'hydroxide', 'format' => FORMAT_MOODLE,
|
||||||
array('answer' => array('text' => '7', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
||||||
array('answer' => array('text' => '1', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
array('answer' => array('text' => 'negative', 'format' => FORMAT_MOODLE,
|
||||||
array('answer' => array('text' => '10<sup>-7</sup>', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
'files' => array()), 'choicegroup' => 1, 'infinite' => false),
|
||||||
array('answer' => array('text' => 'greater', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 3, 'infinite' => false),
|
array('answer' => array('text' => '10<sup>7</sup>', 'format' => FORMAT_MOODLE,
|
||||||
array('answer' => array('text' => 'less', 'format' => FORMAT_MOODLE, 'files' => array()), 'choicegroup' => 3, 'infinite' => false),
|
'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
||||||
|
array('answer' => array('text' => '7', 'format' => FORMAT_MOODLE,
|
||||||
|
'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
||||||
|
array('answer' => array('text' => '1', 'format' => FORMAT_MOODLE,
|
||||||
|
'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
||||||
|
array('answer' => array('text' => '10<sup>-7</sup>', 'format' => FORMAT_MOODLE,
|
||||||
|
'files' => array()), 'choicegroup' => 2, 'infinite' => false),
|
||||||
|
array('answer' => array('text' => 'greater', 'format' => FORMAT_MOODLE,
|
||||||
|
'files' => array()), 'choicegroup' => 3, 'infinite' => false),
|
||||||
|
array('answer' => array('text' => 'less', 'format' => FORMAT_MOODLE,
|
||||||
|
'files' => array()), 'choicegroup' => 3, 'infinite' => false),
|
||||||
);
|
);
|
||||||
|
|
||||||
$expectedq->hint = array(
|
$expectedq->hint = array(array('text' => 'You may wish to read Section 9 of ' .
|
||||||
array('text' => 'You may wish to read Section 9 of <em class="italic">Discovering Science</em> Block 8.',
|
'<em class="italic">Discovering Science</em> Block 8.',
|
||||||
'format' => FORMAT_HTML, 'files' => array()),
|
'format' => FORMAT_HTML, 'files' => array()),
|
||||||
array('text' => 'Any incorrect choices will be removed before your final try.',
|
array('text' => 'Any incorrect choices will be removed before your final try.',
|
||||||
'format' => FORMAT_HTML, 'files' => array()),
|
'format' => FORMAT_HTML, 'files' => array()),
|
||||||
);
|
);
|
||||||
$expectedq->hintshownumcorrect = array(true, true);
|
$expectedq->hintshownumcorrect = array(true, true);
|
||||||
|
@ -416,14 +457,22 @@ class qtype_ddwtos_test extends UnitTestCase {
|
||||||
$qdata->options->incorrectfeedbackformat = FORMAT_MOODLE;
|
$qdata->options->incorrectfeedbackformat = FORMAT_MOODLE;
|
||||||
|
|
||||||
$qdata->options->answers = array(
|
$qdata->options->answers = array(
|
||||||
13 => new question_answer(13, 'Alpha', 0, 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}', FORMAT_MOODLE),
|
13 => new question_answer(13, 'Alpha', 0,
|
||||||
14 => new question_answer(14, 'Beta', 0, 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}', FORMAT_MOODLE),
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}',
|
||||||
15 => new question_answer(15, 'Gamma', 0, 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:1;}', FORMAT_MOODLE),
|
FORMAT_MOODLE),
|
||||||
|
14 => new question_answer(14, 'Beta', 0,
|
||||||
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:0;}',
|
||||||
|
FORMAT_MOODLE),
|
||||||
|
15 => new question_answer(15, 'Gamma', 0,
|
||||||
|
'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";b:1;}',
|
||||||
|
FORMAT_MOODLE),
|
||||||
);
|
);
|
||||||
|
|
||||||
$qdata->hints = array(
|
$qdata->hints = array(
|
||||||
1 => new question_hint_with_parts(1, 'Try again.', FORMAT_MOODLE, true, false),
|
1 => new question_hint_with_parts(1, 'Try again.', FORMAT_MOODLE, true, false),
|
||||||
2 => new question_hint_with_parts(2, 'These are the first three letters of the Greek alphabet.', FORMAT_MOODLE, true, true),
|
2 => new question_hint_with_parts(2,
|
||||||
|
'These are the first three letters of the Greek alphabet.',
|
||||||
|
FORMAT_MOODLE, true, true),
|
||||||
);
|
);
|
||||||
|
|
||||||
$exporter = new qformat_xml();
|
$exporter = new qformat_xml();
|
||||||
|
|
|
@ -39,7 +39,8 @@ require_once($CFG->dirroot . '/question/type/ddwtos/simpletest/helper.php');
|
||||||
*/
|
*/
|
||||||
class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
|
|
||||||
protected function get_contains_drop_box_expectation($place, $group, $readonly, $stateclass = '0') {
|
protected function get_contains_drop_box_expectation($place, $group, $readonly,
|
||||||
|
$stateclass = '0') {
|
||||||
$qa = $this->quba->get_question_attempt($this->slot);
|
$qa = $this->quba->get_question_attempt($this->slot);
|
||||||
|
|
||||||
$expectedattrs = array(
|
$expectedattrs = array(
|
||||||
|
@ -77,9 +78,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(3),
|
$this->get_tries_remaining_expectation(3),
|
||||||
|
@ -95,9 +99,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '2'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '2'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '2'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '2'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
|
@ -117,7 +124,8 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_submit_button_expectation(false),
|
$this->get_contains_submit_button_expectation(false),
|
||||||
$this->get_contains_try_again_button_expectation(true),
|
$this->get_contains_try_again_button_expectation(true),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
new PatternExpectation('/' . preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
new PatternExpectation('/' .
|
||||||
|
preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
||||||
$this->get_contains_hint_expectation('This is the first hint'));
|
$this->get_contains_hint_expectation('This is the first hint'));
|
||||||
|
|
||||||
// Do try again.
|
// Do try again.
|
||||||
|
@ -130,9 +138,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '2'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '2'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '2'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '2'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
|
@ -175,9 +186,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
// Save a partial answer.
|
// Save a partial answer.
|
||||||
|
@ -190,9 +204,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '2'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
|
@ -206,9 +223,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '1'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
|
@ -249,9 +269,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
$this->check_step_count(1);
|
$this->check_step_count(1);
|
||||||
|
@ -266,9 +289,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
$this->check_step_count(1);
|
$this->check_step_count(1);
|
||||||
|
@ -299,9 +325,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
|
@ -315,9 +344,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
|
@ -339,8 +371,10 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
// Create a drag-and-drop question.
|
// Create a drag-and-drop question.
|
||||||
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
||||||
$dd->hints = array(
|
$dd->hints = array(
|
||||||
new question_hint_with_parts(1, 'This is the first hint.', FORMAT_MOODLE, true, true),
|
new question_hint_with_parts(1, 'This is the first hint.',
|
||||||
new question_hint_with_parts(2, 'This is the second hint.', FORMAT_MOODLE, true, true),
|
FORMAT_MOODLE, true, true),
|
||||||
|
new question_hint_with_parts(2, 'This is the second hint.',
|
||||||
|
FORMAT_MOODLE, true, true),
|
||||||
);
|
);
|
||||||
$dd->shufflechoices = false;
|
$dd->shufflechoices = false;
|
||||||
$this->start_attempt_at_question($dd, 'interactive', 9);
|
$this->start_attempt_at_question($dd, 'interactive', 9);
|
||||||
|
@ -354,9 +388,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(3),
|
$this->get_tries_remaining_expectation(3),
|
||||||
|
@ -376,18 +413,23 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_submit_button_expectation(false),
|
$this->get_contains_submit_button_expectation(false),
|
||||||
$this->get_contains_try_again_button_expectation(true),
|
$this->get_contains_try_again_button_expectation(true),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
new PatternExpectation('/' . preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
new PatternExpectation('/' .
|
||||||
|
preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
||||||
$this->get_contains_hint_expectation('This is the first hint'),
|
$this->get_contains_hint_expectation('This is the first hint'),
|
||||||
$this->get_contains_num_parts_correct(2),
|
$this->get_contains_num_parts_correct(2),
|
||||||
$this->get_contains_standard_partiallycorrect_combined_feedback_expectation(),
|
$this->get_contains_standard_partiallycorrect_combined_feedback_expectation(),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'));
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'));
|
||||||
|
|
||||||
// Check that extract responses will return the reset data.
|
// Check that extract responses will return the reset data.
|
||||||
$prefix = $this->quba->get_field_prefix($this->slot);
|
$prefix = $this->quba->get_field_prefix($this->slot);
|
||||||
$this->assertEqual(array('p1' => '1', 'p2' => '1'),
|
$this->assertEqual(array('p1' => '1', 'p2' => '1'),
|
||||||
$this->quba->extract_responses($this->slot, array($prefix . 'p1' => '1', $prefix . 'p2' => '1', '-tryagain' => 1)));
|
$this->quba->extract_responses($this->slot,
|
||||||
|
array($prefix . 'p1' => '1', $prefix . 'p2' => '1', '-tryagain' => 1)));
|
||||||
|
|
||||||
// Do try again.
|
// Do try again.
|
||||||
$this->process_submission(array('p1' => '1', 'p2' => '1', '-tryagain' => 1));
|
$this->process_submission(array('p1' => '1', 'p2' => '1', '-tryagain' => 1));
|
||||||
|
@ -399,9 +441,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_try_again_button_expectation(),
|
$this->get_does_not_contain_try_again_button_expectation(),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
|
@ -422,13 +467,17 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_submit_button_expectation(false),
|
$this->get_contains_submit_button_expectation(false),
|
||||||
$this->get_contains_try_again_button_expectation(true),
|
$this->get_contains_try_again_button_expectation(true),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
new PatternExpectation('/' . preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
new PatternExpectation('/' .
|
||||||
|
preg_quote(get_string('notcomplete', 'qbehaviour_interactive')) . '/'),
|
||||||
$this->get_contains_hint_expectation('This is the second hint'),
|
$this->get_contains_hint_expectation('This is the second hint'),
|
||||||
$this->get_contains_num_parts_correct(2),
|
$this->get_contains_num_parts_correct(2),
|
||||||
$this->get_contains_standard_partiallycorrect_combined_feedback_expectation(),
|
$this->get_contains_standard_partiallycorrect_combined_feedback_expectation(),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '1'));
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '1'));
|
||||||
|
|
||||||
// Do try again.
|
// Do try again.
|
||||||
$this->process_submission(array('p1' => '1', 'p3' => '1', '-tryagain' => 1));
|
$this->process_submission(array('p1' => '1', 'p3' => '1', '-tryagain' => 1));
|
||||||
|
@ -440,9 +489,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '1'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_try_again_button_expectation(),
|
$this->get_does_not_contain_try_again_button_expectation(),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
|
@ -466,9 +518,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_no_hint_visible_expectation(),
|
$this->get_no_hint_visible_expectation(),
|
||||||
$this->get_does_not_contain_num_parts_correct(),
|
$this->get_does_not_contain_num_parts_correct(),
|
||||||
$this->get_contains_standard_correct_combined_feedback_expectation(),
|
$this->get_contains_standard_correct_combined_feedback_expectation(),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '1'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '1'));
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '1'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_interactive_correct_no_submit() {
|
public function test_interactive_correct_no_submit() {
|
||||||
|
@ -476,8 +531,10 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
// Create a drag-and-drop question.
|
// Create a drag-and-drop question.
|
||||||
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
||||||
$dd->hints = array(
|
$dd->hints = array(
|
||||||
new question_hint_with_parts(23, 'This is the first hint.', FORMAT_MOODLE, false, false),
|
new question_hint_with_parts(23, 'This is the first hint.',
|
||||||
new question_hint_with_parts(24, 'This is the second hint.', FORMAT_MOODLE, true, true),
|
FORMAT_MOODLE, false, false),
|
||||||
|
new question_hint_with_parts(24, 'This is the second hint.',
|
||||||
|
FORMAT_MOODLE, true, true),
|
||||||
);
|
);
|
||||||
$dd->shufflechoices = false;
|
$dd->shufflechoices = false;
|
||||||
$this->start_attempt_at_question($dd, 'interactive', 3);
|
$this->start_attempt_at_question($dd, 'interactive', 3);
|
||||||
|
@ -489,9 +546,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(3),
|
$this->get_tries_remaining_expectation(3),
|
||||||
|
@ -527,8 +587,10 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
// Create a drag-and-drop question.
|
// Create a drag-and-drop question.
|
||||||
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
$dd = qtype_ddwtos_test_helper::make_a_ddwtos_question();
|
||||||
$dd->hints = array(
|
$dd->hints = array(
|
||||||
new question_hint_with_parts(23, 'This is the first hint.', FORMAT_MOODLE, false, false),
|
new question_hint_with_parts(23, 'This is the first hint.',
|
||||||
new question_hint_with_parts(24, 'This is the second hint.', FORMAT_MOODLE, true, true),
|
FORMAT_MOODLE, false, false),
|
||||||
|
new question_hint_with_parts(24, 'This is the second hint.',
|
||||||
|
FORMAT_MOODLE, true, true),
|
||||||
);
|
);
|
||||||
$dd->shufflechoices = false;
|
$dd->shufflechoices = false;
|
||||||
$this->start_attempt_at_question($dd, 'interactive', 3);
|
$this->start_attempt_at_question($dd, 'interactive', 3);
|
||||||
|
@ -540,9 +602,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(3),
|
$this->get_tries_remaining_expectation(3),
|
||||||
|
@ -592,9 +657,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(3),
|
$this->get_tries_remaining_expectation(3),
|
||||||
|
@ -625,9 +693,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_contains_submit_button_expectation(true),
|
$this->get_contains_submit_button_expectation(true),
|
||||||
$this->get_does_not_contain_feedback_expectation(),
|
$this->get_does_not_contain_feedback_expectation(),
|
||||||
$this->get_tries_remaining_expectation(2),
|
$this->get_tries_remaining_expectation(2),
|
||||||
|
@ -647,9 +718,12 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
$this->quba->get_field_prefix($this->slot) . 'p1', '0'),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2', '0'),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3', '0'),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
// Save a partial answer.
|
// Save a partial answer.
|
||||||
|
@ -662,9 +736,15 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p1', 1, false),
|
$this->get_contains_drop_box_expectation('p1', 1, false),
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, false),
|
$this->get_contains_drop_box_expectation('p2', 2, false),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, false),
|
$this->get_contains_drop_box_expectation('p3', 3, false),
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p1', $dd->get_right_choice_for(1)),
|
$this->get_contains_hidden_expectation(
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p2', $dd->get_right_choice_for(2)),
|
$this->quba->get_field_prefix($this->slot) . 'p1',
|
||||||
$this->get_contains_hidden_expectation($this->quba->get_field_prefix($this->slot) . 'p3', $dd->get_right_choice_for(3)),
|
$dd->get_right_choice_for(1)),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p2',
|
||||||
|
$dd->get_right_choice_for(2)),
|
||||||
|
$this->get_contains_hidden_expectation(
|
||||||
|
$this->quba->get_field_prefix($this->slot) . 'p3',
|
||||||
|
$dd->get_right_choice_for(3)),
|
||||||
$this->get_does_not_contain_correctness_expectation(),
|
$this->get_does_not_contain_correctness_expectation(),
|
||||||
$this->get_does_not_contain_feedback_expectation());
|
$this->get_does_not_contain_feedback_expectation());
|
||||||
|
|
||||||
|
@ -681,6 +761,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||||
$this->get_contains_drop_box_expectation('p2', 2, true, 'correct'),
|
$this->get_contains_drop_box_expectation('p2', 2, true, 'correct'),
|
||||||
$this->get_contains_drop_box_expectation('p3', 3, true, 'correct'),
|
$this->get_contains_drop_box_expectation('p3', 3, true, 'correct'),
|
||||||
$this->get_contains_correct_expectation(),
|
$this->get_contains_correct_expectation(),
|
||||||
new PatternExpectation('/' . preg_quote('The [quick] brown [fox] jumped over the [lazy] dog.') . '/'));
|
new PatternExpectation('/' .
|
||||||
|
preg_quote('The [quick] brown [fox] jumped over the [lazy] dog.') . '/'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue