Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

(no description)

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

Defines 1 class


Class: imsenterprise_unenrol_test  - X-Ref

IMS Enterprise test case

setUp()   X-Ref
Setup required for all tests.


set_test_config()   X-Ref
Sets the plugin configuration for testing


set_xml_file($users = false, $courses = false, $usercoursemembership = false)   X-Ref
Creates an IMS enterprise XML file and adds it's path to config settings.

param: bool|array $users false or array of users StdClass
param: bool|array $courses false or of courses StdClass
param: bool|array $usercoursemembership false or of courses StdClass

generate_test_user_records($numberofrecordsrequired)   X-Ref
Utility function for generating test user records

param: int $numberofrecordsrequired - number of test users required
return: array of StdClass objects representing test user records

generate_test_course_records($numberofrecordsrequired)   X-Ref
Utility function for generating test course records

param: int $numberofrecordsrequired - number of test course records required
return: array of StdClass objects representing test course records

link_users_with_courses($users, $courses, $linkmatrix)   X-Ref
Utility function for generating test membership structure for given users and courses.
Linkmatrix is expected to be in [row, col] format, where courses are rows and users are columns.
Each element of the link matrix is expected to contain <roletype>:<role status>:<role recstatus>.

param: array $users
param: array $courses
param: array $linkmatrix - matrix/two dimensional array of required user course enrolments
return: array

test_users_are_enroled_on_courses()   X-Ref
Add new users, courses and enrolments


test_no_action_when_unenrol_disabled()   X-Ref
Check that the unenrol actions are completely ignored when "unenrol" setting is disabled


test_existing_roles_and_enrolments_unaffected()   X-Ref
When a user has existing roles and enrolments, they are unaffected by IMS instructions for other courses


test_disable_enrolments_only()   X-Ref
Enrolments alone are disabled


test_disable_enrolments_and_remove_roles()   X-Ref
Enrolments are disabled but retained) and roles removed


test_delete_roles_and_enrolments()   X-Ref
Enrolments and roles are deleted for specified user