diff --git a/classes/external/import_quiz_data.php b/classes/external/import_quiz_data.php index ee76f60..b228771 100644 --- a/classes/external/import_quiz_data.php +++ b/classes/external/import_quiz_data.php @@ -159,7 +159,7 @@ public static function execute(array $quiz, array $sections, array $questions, a $module = get_module_from_cmid($moduleinfo->coursemodule)[0]; // Sort questions by slot. usort($params['questions'], function($a, $b) { - return (int) $a['slot'] > (int) $b['slot']; + return ((int) $a['slot'] > (int) $b['slot']) ? true : false; }); foreach ($params['questions'] as $question) { $qdata = get_minimal_question_data($question['questionbankentryid']); diff --git a/tests/external/export_quiz_data_test.php b/tests/external/export_quiz_data_test.php index da46444..04aff94 100644 --- a/tests/external/export_quiz_data_test.php +++ b/tests/external/export_quiz_data_test.php @@ -94,7 +94,11 @@ public function setUp(): void { $this->quizmoduleid = $this->quiz->cmid; \quiz_add_quiz_question($this->q->id, $this->quiz); \quiz_add_quiz_question($q2->id, $this->quiz); - $quizobj = \quiz::create($this->quiz->id); + if (class_exists('\mod_quiz\quiz_settings')) { + $quizobj = \mod_quiz\quiz_settings::create($this->quiz->id); + } else { + $quizobj = \quiz::create($this->quiz->id); + } \mod_quiz\structure::create_for_quiz($quizobj); }