Differences Between: [Versions 310 and 402] [Versions 310 and 403]
Provides testable_core_plugin_manager class.
Copyright: | 2015 David Mudrak <david@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 124 lines (4 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 1 file lib/tests/fixtures/testable_update_api.php |
testable_core_plugin_manager:: (4 methods):
inject_testable_plugininfo()
get_update_api_client()
load_available_updates_for_plugin()
add_fake_plugin_info()
Class: testable_core_plugin_manager - X-Ref
Testable variant of the core_plugin_managerinject_testable_plugininfo($type, $name, \core\plugininfo\base $plugininfo) X-Ref |
Allows us to inject items directly into the plugins info tree. Do not forget to call our reset_caches() after using this method to force a new singleton instance. param: string $type plugin type param: string $name plugin name param: \core\plugininfo\base $plugininfo plugin info class |
get_update_api_client() X-Ref |
Returns testable subclass of the client. return: \core\update\testable_api |
load_available_updates_for_plugin($component) X-Ref |
Mockup implementation of loading available updates info. This testable implementation does not actually use {@link \core\update\checker}. Instead, it provides hard-coded list of fictional available updates for our foo_bar plugin. Note there is a difference in the behaviour as the actual update API does not return info of lower version than requested. To mock up well, make sure the injected foo_bar testable plugin info has version lower than the lowest one returned here. param: string $component return: array|null array of \core\update\info objects or null |
add_fake_plugin_info($record) X-Ref |
Adds fake plugin information from record. param: stdClass $record return: void |