public function itReturnsEmptyArrayWhenDependenciesAreMet()
 {
     $installed_plugin = array($this->tracker_plugin, $this->fusionforge_compat_plugin);
     stub($this->plugin_manager)->getPluginByName('tracker')->returns($this->tracker_plugin);
     stub($this->plugin_manager)->getPluginByName('fusionforge_compat')->returns($this->fusionforge_compat_plugin);
     stub($this->plugin_manager)->getAllPlugins()->returns($installed_plugin);
     $solver = new PluginDependencySolver($this->plugin_manager);
     $this->assertEqual($solver->getUnmetInstalledDependencies('mediawiki'), array());
 }
 function unavailable()
 {
     $plugin_data = $this->_getPluginFromRequest();
     if ($plugin_data) {
         $plugin_manager = $this->plugin_manager;
         $dependencies = $this->dependency_solver->getAvailableDependencies($plugin_data['plugin']);
         if ($dependencies) {
             $error_msg = $GLOBALS['Language']->getText('plugin_pluginsadministration', 'error_avail_dependency', array($plugin_data['plugin']->getName(), implode(', ', $dependencies)));
             $GLOBALS['Response']->addFeedback('error', $error_msg);
             return;
         }
         if ($plugin_manager->isPluginAvailable($plugin_data['plugin'])) {
             $plugin_manager->unavailablePlugin($plugin_data['plugin']);
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_pluginsadministration', 'feedback_unavailable', array($plugin_data['name'])));
         }
     }
 }
 function confirmUninstall()
 {
     $request =& HTTPRequest::instance();
     if (!$request->exist('plugin_id')) {
         $this->browse();
         return;
     }
     $plugin_manager = $this->plugin_manager;
     $plugin = $plugin_manager->getPluginById((int) $request->get('plugin_id'));
     if (!$plugin) {
         $this->browse();
         return;
     }
     $dependencies = $this->dependency_solver->getInstalledDependencies($plugin);
     if ($dependencies) {
         $error_msg = $GLOBALS['Language']->getText('plugin_pluginsadministration', 'error_uninstall_dependency', $plugin->getName());
         $this->displayDependencyError($dependencies, $error_msg);
         return;
     }
     $this->displayUninstallationConfirmScreen($plugin);
 }