Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403]

Provides {@link core_user_table_participants_search_test} class.

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

Defines 1 class


Class: participants_search_test  - X-Ref

Tests for the implementation of {@link core_user_table_participants_search} class.

convert_recordset_to_array(moodle_recordset $recordset)   X-Ref
Helper to convert a moodle_recordset to an array of records.

param: moodle_recordset $recordset
return: array

create_and_enrol_users(stdClass $course, int $count, ?string $role = null)   X-Ref
Create and enrol a set of users into the specified course.

param: stdClass $course
param: int $count
param: null|string $role
return: array

create_course_with_users(int $editingteachers, int $teachers, int $students, int $norole)   X-Ref
Create a new course with several types of user.

param: int $editingteachers The number of editing teachers to create in the course.
param: int $teachers The number of non-editing teachers to create in the course.
param: int $students The number of students to create in the course.
param: int $norole The number of users with no role to create in the course.
return: stdClass

test_roles_filter(array $usersdata, array $testroles, int $jointype, int $count, array $expectedusers)   X-Ref
Ensure that the roles filter works as expected with the provided test cases.

param: array $usersdata The list of users and their roles to create
param: array $testroles The list of roles to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers

role_provider()   X-Ref
Data provider for role tests.

return: array

test_country_filter(array $usersdata, array $countries, int $jointype, array $expectedusers)   X-Ref
Test participant search country filter

param: array $usersdata
param: array $countries
param: int $jointype
param: array $expectedusers

country_provider()   X-Ref
Data provider for {@see test_country_filter}

return: array

test_keywords_filter(array $usersdata, array $keywords, int $jointype, int $count,array $expectedusers, string $asuser)   X-Ref
Ensure that the keywords filter works as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $keywords The list of keywords to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers
param: string $asuser If non-blank, uses that user account (for identify field permission checks)

keywords_provider()   X-Ref
Data provider for keywords tests.

return: array

test_status_filter(array $usersdata, array $statuses, int $jointype, int $count, array $expectedusers)   X-Ref
Ensure that the enrolment status filter works as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $statuses The list of statuses to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers

status_provider()   X-Ref
Data provider for status filter tests.

return: array

test_enrolments_filter(array $usersdata, array $enrolmethods, int $jointype, int $count,array $expectedusers)   X-Ref
Ensure that the enrolment methods filter works as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $enrolmethods The list of enrolment methods to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers

enrolments_provider()   X-Ref
Data provider for enrolments filter tests.

return: array

test_groups_filter(array $usersdata, array $groupsavailable, array $filtergroups, int $jointype, int $count,array $expectedusers)   X-Ref
Ensure that the groups filter works as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $groupsavailable The names of groups that should be created in the course
param: array $filtergroups The names of groups to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers

groups_provider()   X-Ref
Data provider for groups filter tests.

return: array

test_groups_filter_separate_groups(array $usersdata, array $groupsavailable, array $filtergroups, int $jointype,int $count, array $expectedusers, string $loginusername)   X-Ref
Ensure that the groups filter works as expected when separate groups mode is enabled, with the provided test cases.

param: array $usersdata The list of users to create
param: array $groupsavailable The names of groups that should be created in the course
param: array $filtergroups The names of groups to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers
param: string $loginusername The user to login as for the tests

groups_separate_provider()   X-Ref
Data provider for groups filter tests.

return: array

test_accesssince_filter(array $usersdata, array $accesssince, int $jointype, int $count,array $expectedusers)   X-Ref
Ensure that the last access filter works as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $accesssince The last access data to filter by
param: int $jointype The join type to use when combining filter values
param: int $count The expected count
param: array $expectedusers

accesssince_provider()   X-Ref
Data provider for last access filter tests.

return: array

test_filterset_joins(array $usersdata, array $filterdata, array $groupsavailable, int $jointype, int $count,array $expectedusers)   X-Ref
Ensure that the joins between filters in the filterset work as expected with the provided test cases.

param: array $usersdata The list of users to create
param: array $filterdata The data to filter by
param: array $groupsavailable The names of groups that should be created in the course
param: int $jointype The join type to used between each filter being applied
param: int $count The expected count
param: array $expectedusers

filterset_joins_provider()   X-Ref
Data provider for filterset join tests.

return: array