Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

(no description)

File Size: 180 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