Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Class: category_test  - X-Ref

Tests for class core_course_category

setUp()   X-Ref
No description

get_roleid($context = null)   X-Ref
No description

assign_capability($capability, $permission = CAP_ALLOW, $contextid = null)   X-Ref
No description

test_create_coursecat()   X-Ref
No description

test_name_idnumber_exceptions()   X-Ref
No description

test_visibility()   X-Ref
No description

test_hierarchy()   X-Ref
No description

test_update()   X-Ref
No description

test_delete()   X-Ref
No description

test_get_children()   X-Ref
No description

test_get_all_children_ids()   X-Ref
Test the get_all_children_ids function.


test_count_all()   X-Ref
Test the countall function


test_is_simple_site()   X-Ref
Test the is_simple_site function


test_resort_courses()   X-Ref
Test a categories ability to resort courses.


test_get_search_courses()   X-Ref
No description

test_course_contacts()   X-Ref
No description

test_course_contacts_with_duplicates()   X-Ref
No description

test_overview_files()   X-Ref
No description

test_get_nested_name()   X-Ref
No description

test_coursecat_is_uservisible()   X-Ref
No description

test_current_user_coursecat_get()   X-Ref
No description

test_another_user_coursecat_get()   X-Ref
No description

fill_draft_area(array $files)   X-Ref
Creates a draft area for current user and fills it with fake files

return: int draftid for the filearea
param: array $files array of files that need to be added to filearea, filename => filecontents

test_get_courses_during_delete()   X-Ref
This test ensures that is the list of courses in a category can be retrieved while a course is being deleted.


test_get_nearest_editable_subcategory()   X-Ref
Test get_nearest_editable_subcategory() method.


test_get_nearest_editable_subcategory_with_hidden_categories(int $visible = 0,bool $child = false,string $role = 'manager',array $permissions = [],bool $result = false)   X-Ref
Test get_nearest_editable_subcategory() method with hidden categories.

param: int $visible  Whether the category is visible or not.
param: bool $child   Whether the category is child of main category or not.
param: string $role  The role the user must have.
param: array $permissions An array of permissions we must check.
param: bool $result Whether the result should be the category or null.

get_nearest_editable_subcategory_provider()   X-Ref
Data provider for test_get_nearest_editable_subcategory_with_hidden_categories().

return: array

test_make_category_list_context()   X-Ref
This test ensures that the filter context list is populated by the correct filter contexts from make_category_list.