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 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

User external PHPunit tests

Copyright: 2012 Jerome Mouneyrac
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1771 lines (77 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: externallib_test  - X-Ref

test_get_users()   X-Ref
Test get_users


test_get_users_by_field()   X-Ref
Test get_users_by_field


get_course_user_profiles_setup($capability)   X-Ref
No description

test_get_course_user_profiles()   X-Ref
Test get_course_user_profiles


test_get_user_course_profile_as_admin()   X-Ref
No description

test_create_users()   X-Ref
Test create_users


test_create_users_empty_password()   X-Ref
Test create_users with password and createpassword parameter not set.


create_users_provider_with_same_emails()   X-Ref
Data provider for \core_user_externallib_testcase::test_create_users_with_same_emails().


test_create_users_with_same_emails($sameemailallowed, $differentcase)   X-Ref
Test for \core_user_external::create_users() when user using the same email addresses are being created.

param: int $sameemailallowed The value to set for $CFG->allowaccountssameemail.
param: boolean $differentcase Whether to user a different case for the other user.

test_create_users_invalid_parameter(array $data, $expectmessage)   X-Ref
Test create_users with invalid parameters

param: array $data User data to attempt to register.
param: string $expectmessage Expected exception message.

data_create_users_invalid_parameter()   X-Ref
Data provider for {@see self::test_create_users_invalid_parameter()}.

return: array

test_delete_users()   X-Ref
Test delete_users


test_update_users()   X-Ref
Test update_users


users_with_same_emails()   X-Ref
Data provider for testing \core_user_external::update_users() for users with same emails

return: array

test_update_users_emails_with_different_cases($allowsameemail, $currentname, $currentemail,$newname, $newemail, $withanotheruser, $successexpected)   X-Ref
Test update_users using similar emails with varying cases.

param: boolean $allowsameemail The value to set for $CFG->allowaccountssameemail.
param: string $currentname The user's current name.
param: string $currentemail The user's current email.
param: string $newname The user's new name.
param: string $newemail The user's new email.
param: boolean $withanotheruser Whether to create another user that has the same email as the target user's new email.
param: boolean $successexpected Whether we expect that the target user's email/name will be updated.

test_add_user_private_files()   X-Ref
Test add_user_private_files


test_add_user_private_files_quota()   X-Ref
Test add_user_private_files quota


test_add_user_device()   X-Ref
Test add user device


test_remove_user_device()   X-Ref
Test remove user device


test_get_user_preferences()   X-Ref
Test get_user_preferences


test_update_picture()   X-Ref
Test update_picture


test_update_picture_disabled()   X-Ref
Test update_picture disabled


test_set_user_preferences_save()   X-Ref
Test set_user_preferences


test_set_user_preferences_save_invalid_pref()   X-Ref
Test set_user_preferences


test_set_user_preferences_invalid_user()   X-Ref
Test set_user_preferences for an invalid user


test_set_user_preferences_invalid_preference()   X-Ref
Test set_user_preferences using an invalid preference


test_set_user_preferences_capability()   X-Ref
Test set_user_preferences for other user not being admin


test_update_user_preferences_unset()   X-Ref
Test update_user_preferences unsetting an existing preference.


test_agree_site_policy()   X-Ref
Test agree_site_policy


test_get_private_files_info()   X-Ref
Test get_private_files_info


test_get_private_files_info_missing_permissions()   X-Ref
Test get_private_files_info missing permissions.


test_external_search_identity()   X-Ref
Test the functionality of the {@see \core_user\external\search_identity} class.


test_external_search_identity_with_alternativefullnameformat()   X-Ref
Test functionality of the {@see \core_user\external\search_identity} class with alternativefullnameformat defined.


test_update_user_preferences_homepage_permission_callback()   X-Ref
Test verifying that update_user_preferences prevents changes to the default homepage for other users.