Beispiel #1
0
 /**
  * A version of {@link plugin_manager::get_plugins()} that prepares some faked
  * testable instances.
  *
  * @param bool $disablecache ignored in this class
  * @return array
  */
 public function get_plugins($disablecache = false)
 {
     global $CFG;
     $this->pluginsinfo = array('mod' => array('foo' => plugininfo_default_factory::make('mod', $CFG->dirroot . '/mod', 'foo', $CFG->dirroot . '/mod/foo', 'testable_plugininfo_mod'), 'bar' => plugininfo_default_factory::make('mod', $CFG->dirroot . '/bar', 'bar', $CFG->dirroot . '/mod/bar', 'testable_plugininfo_mod')));
     $checker = testable_available_update_checker::instance();
     $this->pluginsinfo['mod']['foo']->check_available_updates($checker);
     $this->pluginsinfo['mod']['bar']->check_available_updates($checker);
     return $this->pluginsinfo;
 }
 /**
  * Gathers and returns the information about all plugins of the given type
  *
  * @param string $type the name of the plugintype, eg. mod, auth or workshopform
  * @param string $typerootdir full path to the location of the plugin dir
  * @param string $typeclass the name of the actually called class
  * @return array of plugintype classes, indexed by the plugin name
  */
 public static function get_plugins($type, $typerootdir, $typeclass)
 {
     // get the information about plugins at the disk
     $plugins = get_plugin_list($type);
     $ondisk = array();
     foreach ($plugins as $pluginname => $pluginrootdir) {
         $ondisk[$pluginname] = plugininfo_default_factory::make($type, $typerootdir, $pluginname, $pluginrootdir, $typeclass);
     }
     return $ondisk;
 }
Beispiel #3
0
    /**
     * A version of {@link plugin_manager::get_plugins()} that prepares some faked
     * testable instances.
     *
     * @param bool $disablecache ignored in this class
     * @return array
     */
    public function get_plugins($disablecache = false) {

        $dirroot = dirname(__FILE__).'/fixtures/mockplugins';

        $this->pluginsinfo = array(
            'mod' => array(
                'foo' => plugininfo_default_factory::make('mod', $dirroot.'/mod', 'foo',
                    $dirroot.'/mod/foo', 'testable_plugininfo_mod'),
                'bar' => plugininfo_default_factory::make('mod', $dirroot.'/bar', 'bar',
                    $dirroot.'/mod/bar', 'testable_plugininfo_mod'),
                'baz' => plugininfo_default_factory::make('mod', $dirroot.'/baz', 'baz',
                    $dirroot.'/mod/baz', 'testable_plugininfo_mod'),
                'qux' => plugininfo_default_factory::make('mod', $dirroot.'/qux', 'qux',
                    $dirroot.'/mod/qux', 'testable_plugininfo_mod'),
                'new' => plugininfo_default_factory::make('mod', $dirroot.'/new', 'new',
                    $dirroot.'/mod/new', 'testable_plugininfo_mod'),
            ),
            'foolish' => array(
                'frog' => plugininfo_default_factory::make('foolish', $dirroot.'/mod/foo/lish', 'frog',
                    $dirroot.'/mod/foo/lish/frog', 'testable_pluginfo_foolish'),
                'hippo' => plugininfo_default_factory::make('foolish', $dirroot.'/mod/foo/lish', 'hippo',
                    $dirroot.'/mod/foo/lish/hippo', 'testable_pluginfo_foolish'),
            ),
            'bazmeg' => array(
                'one' => plugininfo_default_factory::make('bazmeg', $dirroot.'/mod/baz/meg', 'one',
                    $dirroot.'/mod/baz/meg/one', 'testable_pluginfo_bazmeg'),
            ),
            'quxcat' => array(
                'one' => plugininfo_default_factory::make('quxcat', $dirroot.'/mod/qux/cat', 'one',
                    $dirroot.'/mod/qux/cat/one', 'testable_pluginfo_quxcat'),
            ),
        );

        $checker = testable_available_update_checker::instance();
        $this->pluginsinfo['mod']['foo']->check_available_updates($checker);
        $this->pluginsinfo['mod']['bar']->check_available_updates($checker);
        $this->pluginsinfo['mod']['baz']->check_available_updates($checker);
        $this->pluginsinfo['mod']['new']->check_available_updates($checker);
        $this->pluginsinfo['bazmeg']['one']->check_available_updates($checker);
        $this->pluginsinfo['quxcat']['one']->check_available_updates($checker);

        return $this->pluginsinfo;
    }