Search moodle.org's
Developer Documentation

See Release Notes

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

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

(no description)

File Size: 129 lines (5 kb)
Included or required: 1 time
Referenced: 56 times
Includes or requires: 0 files

Defines 1 class

externallib_advanced_testcase:: (3 methods):
  assignUserCapability()
  configure_filters()
  unassignUserCapability()


Class: externallib_advanced_testcase  - X-Ref

Helper base class for external tests. Helpfull to test capabilities.

assignUserCapability($capability, $contextid, $roleid = null)   X-Ref
Assign a capability to $USER
The function creates a student $USER if $USER->id is empty

param: string $capability capability name
param: int|context $contextid
param: int $roleid
return: int the role id - mainly returned for creation, so calling function can reuse it

configure_filters($filters)   X-Ref
Configure some filters for external tests.

param: array $filters Filters to enable. Each filter should contain:

unassignUserCapability($capability, $contextid = null, $roleid = null, $courseid = null, $enrol = 'manual')   X-Ref
Unassign a capability to $USER.

param: string $capability capability name.
param: int $contextid set the context id if you used assignUserCapability.
param: int $roleid set the role id if you used assignUserCapability.
param: int $courseid set the course id if you used getDataGenerator->enrol_users.
param: string $enrol set the enrol plugin name if you used getDataGenerator->enrol_users with a different plugin than 'manual'.