Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

Search manager unit tests.

Copyright: 2015 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1550 lines (73 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 search/tests/fixtures/mock_search_area.php
 search/tests/fixtures/testable_core_search.php

Defines 2 classes


Class: search_manager_testcase  - X-Ref

Unit tests for search manager.

setUp()   X-Ref
Courses area id.


tearDown()   X-Ref
No description

test_search_enabled()   X-Ref
No description

test_course_search_url()   X-Ref
No description

test_search_areas()   X-Ref
No description

test_search_config()   X-Ref
No description

test_get_last_indexing_duration()   X-Ref
Tests the get_last_indexing_duration method in the base area class.


test_partial_indexing()   X-Ref
Tests that partial indexing works correctly.


test_index_progress()   X-Ref
Tests the progress display while indexing.

This tests the different logic about displaying progress for slow/fast and
complete/incomplete processing.

test_future_documents()   X-Ref
Tests that documents with modified time in the future are NOT indexed (as this would cause
a problem by preventing it from indexing other documents modified between now and the future
date).


test_context_indexing()   X-Ref
Tests that indexing a specified context works correctly.


test_search_user_accesses()   X-Ref
Adding this test here as get_areas_user_accesses process is the same, results just depend on the context level.

return: void

test_search_user_accesses_blocks()   X-Ref
Tests the block support in get_search_user_accesses.

return: void

test_search_users_accesses_limit_non_enrolled_course()   X-Ref
Tests retrieval of users search areas when limiting to a course the user is not enrolled in


test_search_user_accesses_allavailable()   X-Ref
Test get_areas_user_accesses with regard to the 'all available courses' config option.

return: void

test_search_user_accesses_groups()   X-Ref
Tests group-related aspects of the get_areas_user_accesses function.


test_is_search_area()   X-Ref
test_is_search_area

return: void

test_request_index()   X-Ref
Tests the request_index function used for reindexing certain contexts. This only tests
adding things to the request list, it doesn't test that they are actually indexed by the
scheduled task.


test_process_index_requests()   X-Ref
Tests the process_index_requests function.


test_get_search_area_categories()   X-Ref
Test search area categories.


test_is_search_area_categories_enabled()   X-Ref
Test that we can find out if search area categories functionality is enabled.


test_should_hide_all_results_category()   X-Ref
Test that we can find out if hiding all results category is enabled.


test_get_default_area_category_name()   X-Ref
Test that we can get default search category name.


test_get_search_area_category_by_name()   X-Ref
Test that we can get correct search area category by its name.


test_include_all_courses_enabled()   X-Ref
Test that we can check that "Include all visible courses" feature is enabled.


test_build_limitcourseids()   X-Ref
Test that we can correctly build a list of courses for a course filter for the search results.


parse_search_area_id_data_provider()   X-Ref
Test data for test_parse_areaid test fucntion.

return: array

test_parse_search_area_id($areaid, $expected)   X-Ref
Test that manager class can parse area id correctly.

param: string $areaid Area id to parse.
param: array $expected Expected result of parsing.

test_parse_invalid_search_area_id()   X-Ref
Test that manager class will throw an exception when parsing an invalid area id.


test_cleaning_up_existing_search_area()   X-Ref
Test getting a coding exception when trying to lean up existing search area.


Class: to  - X-Ref

test_clean_up_non_existing_search_area()   X-Ref
Test clean up of non existing search area.


test_context_deletion()   X-Ref
Tests the context_deleted, course_deleting_start, and course_deleting_finish methods.