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 401 and 403]

(no description)

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

Defines 1 class


Class: auth_test  - X-Ref

Tests for the auth_plugin_lti class.

verify_user_profile_image_updated(int $userid)   X-Ref
Verify the user's profile picture has been set, which is useful to verify picture syncs.

param: int $userid the id of the Moodle user.

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

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

get_mock_member_data_for_user(array $mockuser, string $legacyuserid = '')   X-Ref
Get a mock member structure based on a mock user and, optionally, a legacy user id.

param: array $mockuser the user data
param: string $legacyuserid the id of the user in the platform in 1.1, if different from the id used in 1.3.
return: array

get_mock_launchdata_for_user(array $mockuser, array $mockmigration = [])   X-Ref
Get mocked JWT data for the given user, including optionally the migration claim information if provided.

param: array $mockuser the user data
param: array $mockmigration information needed to mock the migration claim
return: array the mock JWT data

test_find_or_create_user_from_launch(?array $legacydata, array $launchdata, array $expected)   X-Ref
Test which verifies a user account can be created/found using the find_or_create_user_from_launch() method.

param: array|null $legacydata legacy user and tool data, if testing migration cases.
param: array $launchdata data describing the launch, including user data and migration claim data.
param: array $expected the test case expectations.

launch_data_provider()   X-Ref
Data provider for testing launch-based authentication.

return: array the test case data.

test_find_or_create_user_from_membership(?array $legacydata, array $memberdata, string $iss,?string $legacyconsumerkey, array $expected)   X-Ref
Test which verifies a user account can be created/found using the find_or_create_user_from_membership() method.

param: array|null $legacydata legacy user and tool data, if testing migration cases.
param: array $memberdata data describing the membership data, including user data and legacy user id info.
param: string $iss the issuer URL string
param: string|null $legacyconsumerkey optional legacy consumer_key value for testing user migration
param: array $expected the test case expectations.

membership_data_provider()   X-Ref
Data provider for testing membership-service-based authentication.

return: array the test case data.

test_create_user_binding()   X-Ref
Test the behaviour of create_user_binding().