当前位置: 首页>>代码示例>>PHP>>正文


PHP PluginManager::setInstance方法代码示例

本文整理汇总了PHP中PluginManager::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::setInstance方法的具体用法?PHP PluginManager::setInstance怎么用?PHP PluginManager::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginManager的用法示例。


在下文中一共展示了PluginManager::setInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->old_cwd = getcwd();
     $this->system_command = new System_Command();
     parent::setUp();
     $this->old_sys_data_dir = isset($GLOBALS['sys_data_dir']) ? $GLOBALS['sys_data_dir'] : null;
     $GLOBALS['sys_data_dir'] = parent::getTmpDir();
     $GLOBALS['tmp_dir'] = dirname(__FILE__) . '/_fixtures/tmp';
     mkdir("{$GLOBALS['sys_data_dir']}/gitolite/admin/", 0777, true);
     mkdir("{$GLOBALS['sys_data_dir']}/gitolite/repositories/test_project", 0777, true);
     $sys_data_dir_arg = escapeshellarg($GLOBALS['sys_data_dir']);
     $this->system_command->exec("chmod -R 777 {$sys_data_dir_arg}/gitolite/repositories");
     ForgeConfig::store();
     $this->git_dao = new MyMockGitDao();
     $plugin_dao = mock('PluginDao');
     ProjectManager::clearInstance();
     $this->project_manager = ProjectManager::instance();
     $this->logger = mock('Logger');
     $this->git_plugin = new GitPlugin(1);
     $this->git_factory = new GitRepositoryFactory($this->git_dao, $this->project_manager);
     $this->git_systemeventmanager = mock('Git_SystemEventManager');
     $this->mirror_updater = mock('GitRepositoryMirrorUpdater');
     $this->mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper');
     $this->git_manager = new GitRepositoryManager($this->git_factory, $this->git_systemeventmanager, $this->git_dao, parent::getTmpDir(), $this->mirror_updater, $this->mirror_data_mapper);
     $restricted_plugin_dao = mock('RestrictedPluginDao');
     $plugin_factory = new PluginFactory($plugin_dao, new PluginResourceRestrictor($restricted_plugin_dao));
     $plugin_manager = new PluginManager($plugin_factory, EventManager::instance(), new SiteCache($this->logger), new ForgeUpgradeConfig(new System_Command()));
     PluginManager::setInstance($plugin_manager);
     $this->ugroup_dao = mock('UGroupDao');
     $this->ugroup_manager = new UGroupManager($this->ugroup_dao, mock('EventManager'));
     $this->permission_dao = mock('PermissionsDAO');
     $permissions_manager = new PermissionsManager($this->permission_dao);
     $git_mirror_dao = mock('Git_Mirror_MirrorDao');
     $git_gitolite_driver = new Git_GitoliteDriver($this->logger, $this->git_systemeventmanager, mock('Git_GitRepositoryUrlManager'), $this->git_dao, $git_mirror_dao, $this->git_plugin, null, null, mock('Git_Gitolite_ConfigPermissionsSerializer'), null, null, mock('Git_Mirror_MirrorDataMapper'));
     $gitolite = new Git_Backend_Gitolite($git_gitolite_driver, $this->logger);
     $this->importer = new GitXmlImporter($this->logger, $this->git_manager, $this->git_factory, $gitolite, $this->git_systemeventmanager, $permissions_manager, $this->ugroup_manager);
     $this->temp_project_dir = parent::getTmpDir() . DIRECTORY_SEPARATOR . 'test_project';
     $userManager = mock('UserManager');
     stub($userManager)->getUserById()->returns(new PFUser());
     UserManager::setInstance($userManager);
     stub($this->permission_dao)->clearPermission()->returns(true);
     stub($this->permission_dao)->addPermission()->returns(true);
     stub($this->git_dao)->getProjectRepositoryList()->returns(array());
     copy(__DIR__ . '/_fixtures/stable_repo_one_commit.bundle', parent::getTmpDir() . DIRECTORY_SEPARATOR . 'stable.bundle');
     $this->project = $this->project_manager->getProjectFromDbRow(array('group_id' => 123, 'unix_group_name' => 'test_project', 'access' => Project::ACCESS_PUBLIC));
 }
开发者ID:blestab,项目名称:tuleap,代码行数:46,代码来源:GitXmlImporterTest.php


注:本文中的PluginManager::setInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。