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.

Class: component_test  - X-Ref

core_component related tests.

test_get_core_subsystems()   X-Ref
To be changed if number of subsystems increases/decreases,
this is defined here to annoy devs that try to add more without any thinking,
always verify that it does not collide with any existing add-on modules and subplugins!!!


test_deprecated_get_core_subsystems()   X-Ref
No description

test_get_plugin_types()   X-Ref
No description

test_deprecated_get_plugin_types()   X-Ref
No description

test_get_plugin_list()   X-Ref
No description

test_deprecated_get_plugin_list()   X-Ref
No description

test_get_plugin_directory()   X-Ref
No description

test_deprecated_get_plugin_directory()   X-Ref
No description

test_get_subsystem_directory()   X-Ref
No description

test_is_valid_plugin_name(array $arguments, bool $expected)   X-Ref
Test that the get_plugin_list_with_file() function returns the correct list of plugins.

param: array $arguments
param: bool $expected

is_valid_plugin_name_provider()   X-Ref
Data provider for the is_valid_plugin_name function.

return: array

test_normalize_componentname()   X-Ref
No description

test_normalize_component()   X-Ref
No description

test_deprecated_normalize_component()   X-Ref
No description

test_get_component_directory()   X-Ref
No description

test_deprecated_get_component_directory()   X-Ref
No description

test_get_subtype_parent()   X-Ref
No description

test_get_subplugins()   X-Ref
No description

test_get_plugin_types_with_subplugins()   X-Ref
No description

test_get_plugin_list_with_file()   X-Ref
No description

test_get_component_classes_in_namespace()   X-Ref
No description

classloader_provider()   X-Ref
Data provider for classloader test


test_classloader($psr0, $psr4, $classname, $includedfiles)   X-Ref
Test the classloader.

param: array $psr0 The PSR-0 namespaces to be used in the test.
param: array $psr4 The PSR-4 namespaces to be used in the test.
param: string $classname The name of the class to attempt to load.
param: string $includedfiles The file expected to be loaded.

psr_classloader_provider()   X-Ref
Data provider for psr_classloader test


test_psr_classloader($psr0, $psr4, $classname, $file)   X-Ref
Test the PSR classloader.

param: array $psr0 The PSR-0 namespaces to be used in the test.
param: array $psr4 The PSR-4 namespaces to be used in the test.
param: string $classname The name of the class to attempt to load.
param: string|bool $file The expected file corresponding to the class or false for nonexistant.

get_class_file_provider()   X-Ref
Data provider for get_class_file test


test_get_class_file($classname, $prefix, $path, $separators, $result)   X-Ref
Test the PSR classloader.

param: string $classname the name of the class.
param: string $prefix The namespace prefix used to identify the base directory of the source files.
param: string $path The relative path to the base directory of the source files.
param: string[] $separators The characters that should be used for separating.
param: string|bool $result The expected result to be returned from get_class_file.

test_get_component_list_contains_all_components()   X-Ref
Confirm the get_component_list method contains an entry for every component.


test_get_component_names()   X-Ref
Test the get_component_names() method.


test_apis_methods()   X-Ref
Basic tests for APIs related functions in the core_component class.


test_apis_json_validation()   X-Ref
Test that the apis.json structure matches expectations

While we include an apis.schema.json file in core, there isn't any PHP built-in allowing us
to validate it (3rd part libraries needed). Plus the schema doesn't allow to validate things
like uniqueness or sorting. We are going to do all that here.

test_has_monologo_icon()   X-Ref
Test for monologo icons check in plugins.

return: void

test_get_db_directories_hash()   X-Ref
No description