Developer Documentation

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
  • Differences Between: [Versions 37 and 311] [Versions 38 and 311] [Versions 39 and 311]

    Tests for the sync_members scheduled task class.

    Copyright: 2016 Jun Pataleta <>
    License: GNU GPL v3 or later
    File Size: 400 lines (13 kb)
    Included or required:0 times
    Referenced: 0 times
    Includes or requires: 0 files

    Defines 2 classes

    Class: sync_members_testcase  - 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

    pop_current_users()   X-Ref
    Helper method that removes an element in the array of current users.

    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)   X-Ref
    Exposes sync_members::sync_unenrol()

    param: stdClass $tool
    return: int