Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: restore_test  - X-Ref

Course restore testcase.

backup_course($courseid, $userid = 2)   X-Ref
Backup a course and return its backup ID.

param: int $courseid The course ID.
param: int $userid The user doing the backup.
return: string

create_role_with_caps($caps, $perm)   X-Ref
Create a role with capabilities and permissions.

param: string|array $caps Capability names.
param: int $perm Constant CAP_* to apply to the capabilities.
return: int The new role ID.

restore_course($backupid, $courseid, $userid)   X-Ref
Restore a course.

param: int $backupid The backup ID.
param: int $courseid The course ID to restore in, or 0.
param: int $userid The ID of the user performing the restore.
return: stdClass The updated course object.

restore_to_existing_course($backupid, $courseid, $userid = 2)   X-Ref
Restore a course to an existing course.

param: int $backupid The backup ID.
param: int $courseid The course ID to restore in.
param: int $userid The ID of the user performing the restore.
return: stdClass The updated course object.

restore_to_new_course($backupid, $userid = 2)   X-Ref
Restore a course to a new course.

param: int $backupid The backup ID.
param: int $userid The ID of the user performing the restore.
return: stdClass The new course object.

async_restore_course($backupid, $courseid, $userid, $target)   X-Ref
Restore a course.

param: int $backupid The backup ID.
param: int $courseid The course ID to restore in, or 0.
param: int $userid The ID of the user performing the restore.
param: int $target THe target of the restore.
return: stdClass The updated course object.

async_restore_to_existing_course($backupid, $courseid,$userid = 2, $target = backup::TARGET_CURRENT_ADDING)   X-Ref
Restore a course to an existing course.

param: int $backupid The backup ID.
param: int $courseid The course ID to restore in.
param: int $userid The ID of the user performing the restore.
param: int $target The type of restore we are performing.
return: stdClass The updated course object.

async_restore_to_new_course($backupid, $userid = 2)   X-Ref
Restore a course to a new course.

param: int $backupid The backup ID.
param: int $userid The ID of the user performing the restore.
return: stdClass The new course object.

test_async_restore_existing_idnumber_in_new_course()   X-Ref
No description

test_async_restore_course_info_in_existing_course()   X-Ref
No description

test_async_restore_course_info_in_existing_course_delete_first()   X-Ref
No description

test_restore_existing_idnumber_in_new_course()   X-Ref
No description

test_restore_non_existing_idnumber_in_new_course()   X-Ref
No description

test_restore_existing_idnumber_in_existing_course()   X-Ref
No description

test_restore_non_existing_idnumber_in_existing_course()   X-Ref
No description

test_restore_idnumber_in_existing_course_without_permissions()   X-Ref
No description

test_restore_course_info_in_new_course()   X-Ref
No description

test_restore_course_info_in_existing_course()   X-Ref
No description

test_restore_course_shortname_in_existing_course_without_permissions()   X-Ref
No description

test_restore_course_fullname_in_existing_course_without_permissions()   X-Ref
No description

test_restore_course_summary_in_existing_course_without_permissions()   X-Ref
No description

test_restore_course_startdate_in_existing_course_without_permissions()   X-Ref
No description

test_restore_editor_courseformat()   X-Ref
Tests course restore with editor in course format.

author: Matthew Hilton