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.

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

(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