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 311 and 403]

Content bank repository search unit tests.

Copyright: 2020 Mihail Geshoski <mihail@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 246 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: search_test  - X-Ref

Tests for the content bank search class.

test_get_search_contents(array $contentnames, string $search, array $expected)   X-Ref
Test get_search_contents() by searching through some existing content using different search terms.

param: array $contentnames The array containing the names of the content that needs to be generated
param: string $search The search string
param: array $expected The array containing the expected content names that should be returned by the search

get_search_contents_provider()   X-Ref
Data provider for test_get_search_contents().

return: array

test_get_search_contents_user_can_access_all_content()   X-Ref
Test get_search_contents() by searching for content with users that have capability to access/view
all existing content bank content. By default, admins, managers should be able to view every existing content
that matches the search criteria.


test_get_search_contents_user_can_access_certain_content()   X-Ref
Test get_search_contents() by searching for content with users that have capability to access/view only
certain existing content bank content. By default, editing teachers should be able to view content that matches
the search criteria AND is in the courses they are enrolled, course categories of the enrolled courses
and system content. Other authenticated users should be able to access only the system content.