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: profilelib_test  - X-Ref

Unit tests for user/profile/lib.php.

setUpBeforeClass()   X-Ref
Load required test libraries


test_get_custom_fields()   X-Ref
Tests profile_get_custom_fields function and checks it is consistent
with profile_user_record.


test_default_constructor()   X-Ref
Make sure that all profile fields can be initialised without arguments.


test_profile_view()   X-Ref
Test profile_view function


test_profile_has_required_custom_fields_set()   X-Ref
Test that {@link user_not_fully_set_up()} takes required custom fields into account.


test_profile_fields_in_generator()   X-Ref
Test that user generator sets the custom profile fields


test_profile_get_custom_field_data_by_shortname_normal()   X-Ref
Tests the profile_get_custom_field_data_by_shortname function when working normally.


test_profile_get_custom_field_data_by_shortname_missing()   X-Ref
Tests the profile_get_custom_field_data_by_shortname function with a field that doesn't exist.


profile_get_custom_field_data_by_shortname_case_sensitivity_provider()   X-Ref
Data provider for {@see test_profile_get_custom_field_data_by_shortname_case_sensitivity}

return: array[]

test_profile_get_custom_field_data_by_shortname_case_sensitivity(string $shortname,string $shortnamesearch,bool $casesensitive,bool $expectmatch)   X-Ref
Test retrieving custom field by shortname, specifying case-sensitivity when matching

param: string $shortname
param: string $shortnamesearch
param: bool $casesensitive
param: bool $expectmatch

test_profile_get_user_field()   X-Ref
Test profile field loading via profile_get_user_field helper