MDL-52811 course: moodle/course:setforcedlanguage integration fixes
authorDavo Smith <davo.smith@synergy-learning.com>
Mon, 5 Feb 2018 13:20:42 +0000 (13:20 +0000)
committerDavo Smith <davo.smith@synergy-learning.com>
Mon, 5 Feb 2018 13:20:42 +0000 (13:20 +0000)
admin/tool/uploadcourse/tests/course_test.php
backup/moodle2/restore_stepslib.php

index 1d329fd..f52ec31 100644 (file)
@@ -266,7 +266,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
         global $DB;
         $this->resetAfterTest(true);
 
-        cron_setup_user(); // To avoid warnings related to 'moodle/course:setforcedlanguage' capability check.
+        $this->setAdminUser(); // To avoid warnings related to 'moodle/course:setforcedlanguage' capability check.
 
         // Create.
         $mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
index 1814dae..1435d5e 100644 (file)
@@ -1827,7 +1827,7 @@ class restore_course_structure_step extends restore_structure_step {
         // When restoring to a new course we can set all the things except for the ID number.
         $canchangeidnumber = $isnewcourse || has_capability('moodle/course:changeidnumber', $context, $userid);
         $canchangesummary = $isnewcourse || has_capability('moodle/course:changesummary', $context, $userid);
-        $canforcelanguage = has_capability('moodle/course:setforcedlanguage', $context);
+        $canforcelanguage = has_capability('moodle/course:setforcedlanguage', $context, $userid);
 
         $data = (object)$data;
         $data->id = $this->get_courseid();