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.

Differences Between: [Versions 310 and 400] [Versions 39 and 400]

Tests for the sync_members scheduled task class.

Copyright: 2016 Jun Pataleta <jun@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 394 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: sync_members_test  - X-Ref

Tests for the sync_members scheduled task class.

setUp()   X-Ref
No description

test_do_context_membership_request()   X-Ref
Test for sync_members::do_context_membership_request().


test_do_resourcelink_membership_request()   X-Ref
Test for sync_members::do_resourcelink_membership_request().


test_execute_authdisabled()   X-Ref
Test for sync_members::execute() when auth_lti is disabled.


test_execute_enroldisabled()   X-Ref
Test for sync_members::execute() when enrol_lti is disabled.


test_execute()   X-Ref
Test for sync_members::execute().


test_fetch_members_from_consumer_noresourcelink_nocontext()   X-Ref
Test for sync_members::fetch_members_from_consumer() with no resource link nor context associated with the consumer.


test_get_name()   X-Ref
Test for sync_members::get_name().


test_should_sync_enrol()   X-Ref
Test for sync_members::should_sync_enrol().


test_should_sync_unenrol()   X-Ref
Test for sync_members::should_sync_unenrol().


test_sync_member_information()   X-Ref
Test for sync_members::sync_member_information().


test_sync_profile_images()   X-Ref
Test for sync_members::sync_profile_images().


test_sync_unenrol()   X-Ref
Test for sync_members::sync_unenrol().


enable_auth()   X-Ref
Enable auth_lti plugin.


enable_enrol()   X-Ref
Enable enrol_lti plugin.


Class: dummy_sync_members_task  - X-Ref

Class dummy_sync_members_task.

A class that extends sync_members so that we can expose the protected methods that we would like to test.

get_dataconnector()   X-Ref
Exposes/generates the dataconnector property.

return: data_connector

do_context_membership_request(Context $context, ResourceLink $resourcelink = null,$membershipsurltemplate = '')   X-Ref
Exposes sync_members::do_context_membership_request()

return: bool|User[] Array of User objects upon successful membership service request. False, otherwise.
param: Context $context The context object.
param: ResourceLink $resourcelink The resource link object.
param: string $membershipsurltemplate The memberships endpoint URL template.

do_resourcelink_membership_request(ResourceLink $resourcelink)   X-Ref
Exposes sync_members::do_resourcelink_membership_request()

return: bool|User[]
param: ResourceLink $resourcelink

fetch_members_from_consumer(ToolConsumer $consumer)   X-Ref
Exposes sync_members::fetch_members_from_consumer()

return: bool|User[]
param: ToolConsumer $consumer

should_sync_unenrol($syncmode)   X-Ref
Exposes sync_members::should_sync_unenrol()

return: bool
param: int $syncmode The tool's membersyncmode.

should_sync_enrol($syncmode)   X-Ref
Exposes sync_members::should_sync_enrol()

return: bool
param: int $syncmode The tool's membersyncmode.

sync_member_information(\stdClass $tool, ToolConsumer $consumer, $members)   X-Ref
Exposes sync_members::sync_member_information()

return: array
param: \stdClass $tool
param: ToolConsumer $consumer
param: User[] $members

sync_profile_images()   X-Ref
Exposes sync_members::sync_profile_images()

return: int

sync_unenrol(\stdClass $tool, string $consumerkey, array $currentusers)   X-Ref
Exposes sync_members::sync_unenrol()

return: int
param: \stdClass $tool
param: string $consumerkey
param: array $currentusers