MDL-39087 Add missing unit tests for the plugin_manager

This patch improves and adds unit tests for the plugin_manager class.
These unit tests cover the existing functionalities. Tests for the
new features related directly with MDL-38259 will be added in a separate
commit (to make it clear what's related to it).
This commit is contained in:
David Mudrák
2013-04-12 01:42:58 +02:00
parent 7a46a55d00
commit 86a862cdc2
5 changed files with 235 additions and 14 deletions
+13 -1
View File
@@ -298,7 +298,7 @@ class plugin_manager {
* @return plugininfo_base|null the corresponding plugin information.
*/
public function get_plugin_info($component) {
list($type, $name) = normalize_component($component);
list($type, $name) = $this->normalize_component($component);
$plugins = $this->get_plugins();
if (isset($plugins[$type][$name])) {
return $plugins[$type][$name];
@@ -744,6 +744,18 @@ class plugin_manager {
}
}
/**
* Wrapper for the core function {@link normalize_component()}.
*
* This is here just to make it possible to mock it in unit tests.
*
* @param string $component
* @return array
*/
protected function normalize_component($component) {
return normalize_component($component);
}
/**
* Reorders plugin types into a sequence to be displayed
*