Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 604 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: course_enrolment_manager_test  - X-Ref

Test course_enrolment_manager parts.

setUp()   X-Ref
Tests set up


test_get_total_users()   X-Ref
Verify get_total_users() returned number of users expected in every situation.


test_get_users()   X-Ref
Verify get_users() returned number of users expected in every situation.


setup_for_user_identity_tests()   X-Ref
Sets up a custom profile field and the showuseridentity option, and creates a test user
with suitable values set.

return: \stdClass Test user

test_get_users_fields()   X-Ref
Checks that the get_users function returns the correct user fields.


test_get_other_users_fields()   X-Ref
Checks that the get_other_users function returns the correct user fields.


test_get_potential_users_fields()   X-Ref
Checks that the get_potential_users function returns the correct user fields.


test_get_potential_users($perpage, $returnexactcount, $expectedusers, $expectedtotalusers, $expectedmoreusers)   X-Ref
Test get_potential_users without returnexactcount param.

param: int $perpage Number of users per page.
param: bool $returnexactcount Return the exact count or not.
param: int $expectedusers Expected number of users return.
param: int $expectedtotalusers Expected total of users in database.
param: bool $expectedmoreusers Expected for more users return or not.

test_get_potential_users_search_fields()   X-Ref
Tests get_potential_users when the search term includes a custom field.


test_search_other_users($perpage, $returnexactcount, $expectedusers, $expectedtotalusers, $expectedmoreusers)   X-Ref
Test search_other_users with returnexactcount param.

param: int $perpage Number of users per page.
param: bool $returnexactcount Return the exact count or not.
param: int $expectedusers Expected number of users return.
param: int $expectedtotalusers Expected total of users in database.
param: bool $expectedmoreusers Expected for more users return or not.

search_users_provider()   X-Ref
Test case for test_get_potential_users, test_search_other_users and test_search_users tests.

return: array Dataset

test_search_users($perpage, $returnexactcount, $expectedusers, $expectedtotalusers, $expectedmoreusers)   X-Ref
Test search_users function.

param: int $perpage Number of users per page.
param: bool $returnexactcount Return the exact count or not.
param: int $expectedusers Expected number of users return.
param: int $expectedtotalusers Expected total of users in database.
param: bool $expectedmoreusers Expected for more users return or not.

test_search_users_course_groupmode()   X-Ref
Test that search_users observes course group mode restrictions correctly