本文整理汇总了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));
}