Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

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

Defines 1 class


Class: lti_advantage_testcase  - X-Ref

Parent class for LTI Advantage tests, providing environment setup and mock user launches.

lti_advantage_user_authenticates(string $sub, array $migrationclaiminfo = [])   X-Ref
Helper to return a user which has been bound to the LTI credentials provided and is deemed a valid linked user.

return: stdClass the user record.
param: string $sub the subject id string
param: array $migrationclaiminfo mocked migration claim information, allowing the mock auth to bind to an existing user.

get_mock_launch_users_with_ids(array $ids, bool $includepicture = false,string $role = 'http:)   X-Ref
Get a list of users ready for use with mock launches by providing an array of user ids.

return: array the users list.
param: array $ids the platform user_ids for the users.
param: bool $includepicture whether to include a profile picture or not (slows tests, so defaults to false).
param: string $role the LTI role to include in the user data.

get_mock_launch(\stdClass $resource, array $mockuser,?string $resourcelinkid = null, ?array $ags = [], bool $nrps = true, ?array $migrationclaiminfo = null,?array $customparams = null, $aud = '123')   X-Ref
Get a mock LtiMessageLaunch object, as if a user had launched from a resource link in the platform.

return: LtiMessageLaunch the mock launch object with test launch data.
param: \stdClass $resource the resource record, allowing the mock to generate a link to this.
param: array $mockuser the user on the platform who is performing the launch.
param: string|null $resourcelinkid the id of resource link in the platform, if desired.
param: array|null $ags array representing the lti-ags claim info. Pass null to omit, empty array to use a default.
param: bool $nrps whether to include a mock NRPS claim or not.
param: array|null $migrationclaiminfo contains consumer key, secret and any fields which are sent in the claim.
param: array|null $customparams an array of custom params to send, or null to just use defaults.
param: mixed $aud the array or string value of aud to use in the mock launch data.

create_test_environment(bool $enableauthplugin = true, bool $enableenrolplugin = true,bool $membersync = true, int $membersyncmode = helper::MEMBER_SYNC_ENROL_AND_UNENROL,bool $gradesync = true, bool $gradesynccompletion = false, int $enrolstartdate = 0, int $provisioningmodeinstructor = 0,int $provisioningmodelearner = 0)   X-Ref
No description

enable_auth()   X-Ref
Enable auth_lti plugin.


enable_enrol()   X-Ref
Enable enrol_lti plugin.


get_tool_launch_service()   X-Ref
Helper to get a tool_launch_service instance.

return: tool_launch_service the instance.

setup_legacy_data(\stdClass $course, array $legacydata)   X-Ref
Set up data representing a several published legacy tools, including tool records, tool consumer maps and a user.

return: array array containing [tool1record, tool2record, consumerrecord, userrecord].
param: stdClass $course the course in which to create the tools.
param: array $legacydata array containing user id, consumer key and tool secrets for creation of records.