Merge branch 'MDL-64286' of https://github.com/timhunt/moodle
authorDamyon Wiese <damyon@moodle.com>
Mon, 3 Dec 2018 07:46:40 +0000 (15:46 +0800)
committerDamyon Wiese <damyon@moodle.com>
Mon, 3 Dec 2018 07:46:40 +0000 (15:46 +0800)
question/type/gapselect/edit_form_base.php
question/type/gapselect/tests/behat/basic_test.feature

index bd26c77..fb861d5 100644 (file)
@@ -225,8 +225,6 @@ class qtype_gapselect_edit_form_base extends question_edit_form {
     }
 
     protected function data_preprocessing_choice($question, $answer, $key) {
-        // See comment in data_preprocessing_answers.
-        unset($this->_form->_defaultValues['choices[$key][choicegroup]']);
         $question->choices[$key]['answer'] = $answer->answer;
         $question->choices[$key]['choicegroup'] = $answer->feedback;
         return $question;
index d7f9a33..9ae9e36 100644 (file)
@@ -27,9 +27,12 @@ Feature: Test all the basic functionality of this question type
       | General feedback          | The cat sat on the mat.       |
       | id_choices_0_answer       | cat                           |
       | id_choices_1_answer       | sat                           |
+      | id_choices_1_choicegroup  | 2                             |
       | id_choices_2_answer       | mat                           |
       | id_choices_3_answer       | dog                           |
       | id_choices_4_answer       | table                         |
+      | id_choices_5_answer       | ran                           |
+      | id_choices_5_choicegroup  | 2                             |
       | Hint 1                    | First hint                    |
       | Hint 2                    | Second hint                   |
     Then I should see "Select missing words 001"
@@ -48,8 +51,8 @@ Feature: Test all the basic functionality of this question type
       | How questions behave | Interactive with multiple tries |
       | Marked out of        | 3                               |
       | Marks                | Show mark and max               |
-      | Specific feedback    | Shown |
-      | Right answer         | Shown |
+      | Specific feedback    | Shown                           |
+      | Right answer         | Shown                           |
     And I press "Start again with these options"
 
     # Answer question correctly
@@ -113,8 +116,8 @@ Feature: Test all the basic functionality of this question type
 
     # Answer question incorrectly
     And I set space "1" to "mat" in the select missing words question
-    And I set space "2" to "cat" in the select missing words question
-    And I set space "3" to "sat" in the select missing words question
+    And I set space "2" to "ran" in the select missing words question
+    And I set space "3" to "table" in the select missing words question
     And I press "Check"
     Then I should see "Your answer is incorrect"
     And I should see "The cat sat on the mat"
@@ -140,9 +143,12 @@ Feature: Test all the basic functionality of this question type
       | General feedback          | The cat sat on the mat.       |
       | id_choices_0_answer       | cat                           |
       | id_choices_1_answer       | sat                           |
+      | id_choices_1_choicegroup  | 2                             |
       | id_choices_2_answer       | mat                           |
       | id_choices_3_answer       | dog                           |
       | id_choices_4_answer       | table                         |
+      | id_choices_5_answer       | ran                           |
+      | id_choices_5_choicegroup  | 2                             |
       | Hint 1                    | First hint                    |
       | Hint 2                    | Second hint                   |
     And I set the following fields to these values: