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.

Class: datalib_test  - X-Ref

Test for various bits of datalib.php.

normalise_sql($sort)   X-Ref
No description

assert_same_sql($expected, $actual)   X-Ref
No description

test_users_search_sql()   X-Ref
Do a test of the user search SQL with database users.


test_users_order_by_sql_simple()   X-Ref
No description

test_users_order_by_sql_table_prefix()   X-Ref
No description

test_users_order_by_sql_search_no_extra_fields()   X-Ref
No description

test_users_order_by_sql_search_with_extra_fields_and_prefix()   X-Ref
No description

test_users_order_by_sql_search_with_custom_fields()   X-Ref
No description

test_get_admin()   X-Ref
No description

test_get_admins()   X-Ref
No description

test_get_course()   X-Ref
No description

test_get_courses_with_fields()   X-Ref
Test that specifying fields when calling get_courses always returns required fields "id, category, visible"


test_increment_revision_number()   X-Ref
No description

test_get_coursemodule_from_id()   X-Ref
No description

test_get_coursemodule_from_instance()   X-Ref
No description

test_get_coursemodules_in_course()   X-Ref
No description

test_get_all_instances_in_courses()   X-Ref
No description

test_get_all_instances_in_course()   X-Ref
No description

test_max_courses_in_category()   X-Ref
Test max courses in category


test_debug_max_courses_in_category()   X-Ref
Test debug message for max courses in category


test_get_users_listing()   X-Ref
Tests the get_users_listing function.


get_safe_orderby_provider()   X-Ref
Data provider for test_get_safe_orderby().

return: array

test_get_safe_orderby(array $orderbymap, string $orderbykey, string $direction, string $expected)   X-Ref
Tests the get_safe_orderby function.

param: array $orderbymap The ORDER BY parameter mapping array.
param: string $orderbykey The string key being provided, to check against the map.
param: string $direction The optional direction to order by.
param: string $expected The expected string output of the method.

get_safe_orderby_multiple_provider()   X-Ref
Data provider for test_get_safe_orderby_multiple().

return: array

test_get_safe_orderby_multiple(array $orderbymap, array $orderbykeys, array $directions,string $expected)   X-Ref
Tests the get_safe_orderby_multiple function.

param: array $orderbymap The ORDER BY parameter mapping array.
param: array $orderbykeys The array of string keys being provided, to check against the map.
param: array $directions The optional directions to order by.
param: string $expected The expected string output of the method.