diff --git a/src/messenger/tests/server_side/webim/libs/classes/PluginManagerTest.php b/src/messenger/tests/server_side/webim/libs/classes/PluginManagerTest.php index 0fd9a686..42259aaf 100644 --- a/src/messenger/tests/server_side/webim/libs/classes/PluginManagerTest.php +++ b/src/messenger/tests/server_side/webim/libs/classes/PluginManagerTest.php @@ -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()); + } } ?> diff --git a/src/messenger/webim/libs/classes/plugin_manager.php b/src/messenger/webim/libs/classes/plugin_manager.php index a6002745..22a3bb80 100644 --- a/src/messenger/webim/libs/classes/plugin_manager.php +++ b/src/messenger/webim/libs/classes/plugin_manager.php @@ -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() *