diff --git a/lib/tests/completionlib_test.php b/lib/tests/completionlib_test.php index b0625f11821..d9a75de7af5 100644 --- a/lib/tests/completionlib_test.php +++ b/lib/tests/completionlib_test.php @@ -59,15 +59,7 @@ class core_completionlib_testcase extends advanced_testcase { // Create a course with activities. $this->course = $this->getDataGenerator()->create_course(array('enablecompletion' => true)); $this->user = $this->getDataGenerator()->create_user(); - $studentrole = $DB->get_record('role', array('shortname' => 'student')); - $this->assertNotEmpty($studentrole); - - // Get manual enrolment plugin and enrol user. - require_once($CFG->dirroot.'/enrol/manual/locallib.php'); - $manplugin = enrol_get_plugin('manual'); - $maninstance = $DB->get_record('enrol', array('courseid' => $this->course->id, 'enrol' => 'manual'), '*', MUST_EXIST); - $manplugin->enrol_user($maninstance, $this->user->id, $studentrole->id); - $this->assertEquals(1, $DB->count_records('user_enrolments')); + $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id); $this->module1 = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id)); $this->module2 = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id));