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 310 and 401] [Versions 39 and 401]

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()

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

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

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

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

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

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

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

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

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

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

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

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()

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