Search moodle.org's
Developer Documentation

See Release Notes

  • 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.

Unit Tests for the abstract userlist Class

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 262 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: userlist_base_test  - X-Ref

Tests for the \core_privacy API's userlist base functionality.

test_get_userids($input, $expected, $count)   X-Ref
Ensure that get_userids returns the list of unique userids.

param: array   $input List of user IDs
param: array   $expected list of userids
param: int     $count Expected count

get_userids_provider()   X-Ref
Provider for the list of userids.

return: array

test_get_users()   X-Ref
Ensure that get_users returns the correct list of users.


test_countable($input, $expected, $count)   X-Ref
Ensure that the userlist_base is countable.

param: array   $input List of user IDs
param: array   $expected list of userids
param: int     $count Expected count

test_user_iteration()   X-Ref
Ensure that the userlist_base iterates over the set of users.


test_current_user_one_user()   X-Ref
Test that a deleted user is still returned.
If a user has data then it still must be deleted, even if they are deleted.


test_current_user_invalid()   X-Ref
Test that an invalid user returns no entry.


test_current_user_two_users()   X-Ref
Test that where an invalid user is listed, the next user in the list is returned instead.


test_set_component_in_constructor()   X-Ref
Ensure that the component specified in the constructor is used and available.


test_set_context_in_constructor()   X-Ref
Ensure that the context specified in the constructor is available.


Class: test_userlist_base  - X-Ref

A test class extending the userlist_base allowing setting of the userids.

set_userids(array $userids)   X-Ref
Set the contextids for the test class.

param: int[]   $contexids  The list of contextids to use.