mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 01:50:34 +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
|
// Try to get loaded plugin
|
||||||
PluginManager::getPlugin('phpunit_autotest_plugin_manager');
|
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 {
|
Class PluginManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains all loaded plugins
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected static $loaded_plugins = array();
|
protected static $loaded_plugins = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +42,17 @@ Class PluginManager {
|
|||||||
return self::$loaded_plugins[$plugin_name];
|
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()
|
* Loads plugins and invokes Plugin::registerEvents() and Plugin::registerListeners()
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user