MDL-61410 question: fix unit tests failures
[moodle.git] / question / format / xml / format.php
index 0058862..dabec48 100644 (file)
@@ -1476,12 +1476,11 @@ class qformat_xml extends qformat_default {
 
         // Write the question tags.
         if (core_tag_tag::is_enabled('core_question', 'question')) {
-            $tagobjects = core_tag_tag::get_items_tags('core_question', 'question', $question->id);
+            $tagobjects = core_tag_tag::get_item_tags('core_question', 'question', $question->id);
 
             if (!is_null($tagobjects)) {
-                $tagobjects = $tagobjects[$question->id];
-                $categorycontext = context::instance_by_id($this->category->contextid);
-                $sortedtagobjects = question_sort_tags($tagobjects, $categorycontext);
+                $context = context::instance_by_id($contextid);
+                $sortedtagobjects = question_sort_tags($tagobjects, $context, [$this->course]);
 
                 if (!empty($sortedtagobjects->coursetags)) {
                     // Set them on the form to be rendered as existing tags.