MDL-60518 core_competency: Set $USER global variable for tests
authorAmaia Anabitarte <amaia@moodle.com>
Tue, 11 Dec 2018 18:06:52 +0000 (19:06 +0100)
committerAmaia Anabitarte <amaia@moodle.com>
Fri, 14 Dec 2018 09:28:34 +0000 (10:28 +0100)
competency/tests/api_test.php

index 0037152..705a32a 100644 (file)
@@ -2501,6 +2501,10 @@ class core_competency_api_testcase extends advanced_testcase {
         $this->resetAfterTest(true);
         $dg = $this->getDataGenerator();
 
+        // Create and assign a current user.
+        $currentuser = $dg->create_user();
+        $this->setUser($currentuser);
+
         // Create a course.
         $course = $dg->create_course();
         $record = array('courseid' => $course->id, 'pushratingstouserplans' => false);