MDL-53778 quiz: ensure completion deps are fulfilled by generator uses
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 26 Jun 2019 22:01:43 +0000 (00:01 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 26 Jun 2019 23:11:43 +0000 (01:11 +0200)
There are some mod_quiz generator issues where the new chain
of dependencies between completion settings was not being observed.

This patch just ensures that the now 3 chained settings are
enabled together (or new quiz options logic will proceed to
disable them).

mod/quiz/tests/lib_test.php

index bf82227..df77dee 100644 (file)
@@ -166,6 +166,7 @@ class mod_quiz_lib_testcase extends advanced_testcase {
                       'questionsperpage' => 0,
                       'sumgrades' => 1,
                       'completion' => COMPLETION_TRACKING_AUTOMATIC,
+                      'completionusegrade' => 1,
                       'completionpass' => 1);
         $quiz = $quizgenerator->create_instance($data);
         $cm = get_coursemodule_from_id('quiz', $quiz->cmid);
@@ -880,14 +881,14 @@ class mod_quiz_lib_testcase extends advanced_testcase {
         $quiz1 = $this->getDataGenerator()->create_module('quiz', [
             'course' => $course->id,
             'completion' => 2,
+            'completionusegrade' => 1,
             'completionattemptsexhausted' => 1,
             'completionpass' => 1
         ]);
         $quiz2 = $this->getDataGenerator()->create_module('quiz', [
             'course' => $course->id,
             'completion' => 2,
-            'completionattemptsexhausted' => 0,
-            'completionpass' => 0
+            'completionusegrade' => 0
         ]);
         $cm1 = cm_info::create(get_coursemodule_from_instance('quiz', $quiz1->id));
         $cm2 = cm_info::create(get_coursemodule_from_instance('quiz', $quiz2->id));