mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 16:44:11 +03:00
Add PluginManager::getAllPlugins() method
This commit is contained in:
parent
30cb668a73
commit
53e9400dde
@ -71,6 +71,18 @@ class PluginManagerTest extends PHPUnit_Framework_TestCase {
|
||||
// Try to get loaded plugin
|
||||
PluginManager::getPlugin('phpunit_autotest_plugin_manager');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testGetPlugin
|
||||
*/
|
||||
public function testGetAllPlugins() {
|
||||
// Get loaded plugin
|
||||
$plugin = PluginManager::getPlugin('phpunit_autotest_plugin_manager');
|
||||
// Build plugins list to comparison
|
||||
$plugins_list = array('phpunit_autotest_plugin_manager' => $plugin);
|
||||
// Check loaded plugins list
|
||||
$this->assertEquals($plugins_list, PluginManager::getAllPlugins());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -20,6 +20,10 @@
|
||||
*/
|
||||
Class PluginManager {
|
||||
|
||||
/**
|
||||
* Contains all loaded plugins
|
||||
* @var array
|
||||
*/
|
||||
protected static $loaded_plugins = array();
|
||||
|
||||
/**
|
||||
@ -38,6 +42,17 @@ Class PluginManager {
|
||||
return self::$loaded_plugins[$plugin_name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns associative array of loaded plugins.
|
||||
*
|
||||
* Key represents plugin's name and value contains Plugin object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAllPlugins() {
|
||||
return self::$loaded_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads plugins and invokes Plugin::registerEvents() and Plugin::registerListeners()
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user