Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 179 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: roles_backup_restore_test  - X-Ref

Unit tests for how backup and restore handles role-related things.

create_course_with_role_overrides()   X-Ref
Create a course where the (non-editing) Teacher role is overridden
to have 'moodle/user:loginas' and 'moodle/site:accessallgroups'.

return: stdClass the new course.

get_role(string $shortname)   X-Ref
Get the role id from a shortname.

param: string $shortname the role shortname.
return: stdClass the role from the DB.

get_overrides_for_role_on_context(string $shortname, context $context)   X-Ref
Get an array capability => CAP_... constant for all the orverrides set for a given role on a given context.

param: string $shortname role shortname.
param: context $context context.
return: array the overrides set here.

backup_course(\stdClass $course)   X-Ref
Makes a backup of the course.

param: stdClass $course The course object.
return: string Unique identifier for this backup.

restore_adding_to_course(string $backupid, string $asroleshortname)   X-Ref
Restores a backup that has been made earlier.

param: string $backupid The unique identifier of the backup.
param: string $asroleshortname Which role in the new cousre the restorer should have.
return: int The new course id.

test_restore_role_overrides_as_manager()   X-Ref
No description

test_restore_role_overrides_as_teacher()   X-Ref
No description