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.

Class: userlib_test  - X-Ref

Unit tests for user lib api.

test_user_get_user_details_courses()   X-Ref
Test user_get_user_details_courses


test_user_get_user_details_courses_groupmode_nogroups()   X-Ref
Verify return when course groupmode set to 'no groups'.


test_user_get_user_details_courses_groupmode_separate()   X-Ref
Verify return when course groupmode set to 'separate groups'.


test_user_get_user_details_courses_groupmode_visible()   X-Ref
Verify return when course groupmode set to 'visible groups'.


test_user_get_user_details_courses_limit_return()   X-Ref
Tests that the user fields returned by the method can be limited.


test_user_update_user()   X-Ref
Test user_update_user.


test_create_users()   X-Ref
Test create_users.


test_user_create_user_default_values()   X-Ref
Test that creating users populates default values


test_create_user_invalid_username($username, $expectmessage)   X-Ref
Test that {@link user_create_user()} throws exception when invalid username is provided.

param: string $username Invalid username
param: string $expectmessage Expected exception message

data_create_user_invalid_username()   X-Ref
Data provider for {@link self::test_create_user_invalid_username()}.

return: array

test_user_count_login_failures()   X-Ref
Test function user_count_login_failures().


test_user_add_password_history()   X-Ref
Test function user_add_password_history().


test_user_is_previously_used_password()   X-Ref
Test function user_add_password_history().


test_delete_of_hashes_on_user_delete()   X-Ref
Test that password history is deleted together with user.


test_user_list_view()   X-Ref
Test user_list_view function


test_user_menu_custom_avatar_size()   X-Ref
Test setting the user menu avatar size.


test_user_can_view_profile()   X-Ref
Test user_can_view_profile


test_user_get_user_details()   X-Ref
Test user_get_user_details


test_user_get_user_details_missing_fields()   X-Ref
Regression test for MDL-57840.

Ensure the fields "auth, confirmed, idnumber, lang, theme, timezone and mailformat" are present when
calling user_get_user_details() function.

test_user_get_user_details_permissions()   X-Ref
Test user_get_user_details_permissions.


test_user_get_user_details_groups()   X-Ref
Test user_get_user_details_groups.