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.

Class: tool_launch_service_test  - X-Ref

Tests for the tool_launch_service.

test_user_launches_tool(?array $legacydata, ?array $launchdata, array $expected)   X-Ref
Test the use case "A user launches a tool so they can view an external resource/activity".

param: array|null $legacydata array detailing what legacy information to create, or null if not required.
param: array|null $launchdata array containing details of the launch, including user and migration claim.
param: array $expected the array detailing expectations.

user_launch_provider()   X-Ref
Provider for user launch testing.

return: array the test case data.

test_user_launches_tool_missing_custom_id()   X-Ref
Test confirming that an exception is thrown if trying to launch a published resource without a custom id.


test_user_launches_tool_invalid_custom_id()   X-Ref
Test confirming that an exception is thrown if trying to launch a published resource that doesn't exist.


test_user_launches_tool_missing_registration()   X-Ref
Test confirming that an exception is thrown if trying to launch the tool where no application can be found.


test_user_launches_tool_missing_deployment()   X-Ref
Test confirming that an exception is thrown if trying to launch the tool where no deployment can be found.


test_user_launches_tool_role_mapping()   X-Ref
Test the mapping from IMS roles to Moodle roles during a launch.


test_user_launches_tool_user_fields_updated()   X-Ref
Test verifying that a user launch can result in updates to some user fields.


test_user_launches_tool_max_enrolment_start_restriction()   X-Ref
Test the launch when a module has an enrolment start date.


test_user_launches_tool_force_embedding_custom_param()   X-Ref
Test the Moodle-specific custom param 'forceembed' during user launches.


test_user_launches_tool_aud_variations($aud, array $expected)   X-Ref
Test launching the tool with different 'aud' values, confirming the service handles all variations appropriately.

param: mixed $aud the aud value to test
param: array $expected the array of expectations to check

aud_data_provider()   X-Ref
Data provider for testing variations of the 'aud' JWT property.

return: array the test case data

test_user_launches_tool_ags_claim_handling(array $agsclaim1, array $agsclaim2, array $expected)   X-Ref
Test verifying how changes to lti-ags claim information is handled across different launches.

param: array $agsclaim1 the lti-ags claim data to use in the first launch.
param: array $agsclaim2 the lti-ags claim data to use in the second launch.
param: array $expected the array of test case expectations.

ags_claim_provider()   X-Ref
Data provider for testing user_launches tool with varying mocked lti-ags claim data over several launches.

return: array the array of test case data.