diff --git a/tests/event_handlers_test.php b/tests/event_handlers_test.php index fd953d7..a88c3df 100644 --- a/tests/event_handlers_test.php +++ b/tests/event_handlers_test.php @@ -33,7 +33,6 @@ use core\event\course_created; use core\event\course_updated; -use core\event\course_restored; use core\event\course_section_created; use core\event\course_section_updated; use core\event\course_module_created; @@ -328,8 +327,12 @@ public function test_course_restored() { $formdata->role_5 = 5; // Create the course copy records and associated ad-hoc task. - $coursecopy = new \core_backup\copy\copy($formdata); - $coursecopy->create_copy(); + try { + $copydata = \copy_helper::process_formdata($formdata); + \copy_helper::create_copy($copydata); + } catch (\moodle_exception $e) { + throw new moodle_exception('copyformfail', 'backup'); + } // We are expecting trace output during this test, caused by the copy task. $this->expectOutputRegex("/{$course->id}/");