本文整理汇总了PHP中UserManager::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::setInstance方法的具体用法?PHP UserManager::setInstance怎么用?PHP UserManager::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::setInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp() {
parent::setUp();
$user_manager = stub('UserManager')->getAllUsersByEmail()->returns(array());
UserManager::setInstance($user_manager);
$language = stub('BaseLanguage')->getContent('mail/html_template', 'en_US', null, '.php')
->returns(dirname(__FILE__).'/_fixtures/empty.tpl');
$GLOBALS['Language'] = $language;
$this->renderer = mock('TemplateRenderer');
$template_factory = stub('TemplateRendererFactory')->getRenderer()->returns($this->renderer);
$this->builder = new MailBuilder($template_factory);
$emails = array('a@example.com', 'b@example.com');
$subject = 'This is an awesome subject';
$full_body_html = 'Body in <b> HTML </b>';
$full_body_text = 'Body in plain/text';
$goto_link = 'https://tuleap.example.com/goto?key=release&value=116&group_id=116';
$service_name = 'Files';
$this->notification = new Notification(
$emails,
$subject,
$full_body_html,
$full_body_text,
$goto_link,
$service_name
);
$GLOBALS['sys_default_domain'] = '';
$GLOBALS['HTML'] = mock('Layout');
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->user = mock('PFUser');
$user_manager = stub('UserManager')->getCurrentUser()->returns($this->user);
UserManager::setInstance($user_manager);
}
示例3: setUp
public function setUp()
{
parent::setUp();
ForgeConfig::store();
ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
$this->group_id = 123;
$this->project = stub('Project')->getID()->returns($this->group_id);
$this->project_manager = stub('ProjectManager')->getProject($this->group_id)->returns($this->project);
$this->current_user = stub('PFUser')->getId()->returns(666);
$this->request = aRequest()->withProjectManager($this->project_manager)->with('group_id', "{$this->group_id}")->withUser($this->current_user)->build();
$this->planning_factory = new MockPlanningFactory();
$this->planning_controller = new Planning_Controller($this->request, $this->planning_factory, mock('Planning_ShortAccessFactory'), mock('Planning_MilestoneFactory'), mock('ProjectManager'), mock('AgileDashboard_XMLFullStructureExporter'), '/path/to/theme', '/path/to/plugin', mock('AgileDashboard_KanbanManager'), mock('AgileDashboard_ConfigurationManager'), mock('AgileDashboard_KanbanFactory'), mock('PlanningPermissionsManager'));
$configuration_manager = mock('AgileDashboard_ConfigurationManager');
stub($configuration_manager)->getScrumTitle()->returns('Scrum');
stub($configuration_manager)->getKanbanTitle()->returns('Kanban');
stub($configuration_manager)->scrumIsActivatedForProject()->returns(true);
stub($configuration_manager)->kanbanIsActivatedForProject()->returns(true);
$this->controller = new AgileDashboard_Controller($this->request, $this->planning_factory, mock('AgileDashboard_KanbanManager'), mock('AgileDashboard_KanbanFactory'), $configuration_manager, mock('TrackerFactory'), mock('AgileDashboard_PermissionsManager'));
stub($this->planning_factory)->getPotentialPlanningTrackers()->returns(array());
stub($this->planning_factory)->getAvailablePlanningTrackers()->returns(array(1));
stub($this->planning_factory)->getPlanningsOutOfRootPlanningHierarchy()->returns(array());
stub($this->current_user)->useLabFeatures()->returns(false);
if (!defined('IS_SCRIPT')) {
define('IS_SCRIPT', false);
}
$this->user_manager = stub('UserManager')->getCurrentUser()->returns($this->current_user);
UserManager::setInstance($this->user_manager);
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->user_manager = mock('UserManager');
UserManager::setInstance($this->user_manager);
$this->formelement_factory = mock('Tracker_FormElementFactory');
Tracker_FormElementFactory::setInstance($this->formelement_factory);
}
示例5: setUp
public function setUp()
{
parent::setUp();
$user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build();
$this->changeset = aChangeset()->build();
$this->timestamp = '1433863107';
$this->user_manager = stub('UserManager')->getUserById(101)->returns($user);
UserManager::setInstance($this->user_manager);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->user = mock('User');
$user_manager = mock('UserManager');
stub($user_manager)->getUserByUserName()->returns($this->user);
UserManager::setInstance($user_manager);
$this->ugroup_literalizer = new UGroupLiteralizer();
}
示例7: setUp
public function setUp()
{
parent::setUp();
$this->user_manager = mock('UserManager');
$this->user = mock('PFUser');
UserManager::setInstance($this->user_manager);
stub($this->user)->getRealName()->returns('Le roi arthur');
stub($this->user_manager)->getUserById()->returns($this->user);
}
示例8: setUp
public function setUp()
{
parent::setUp();
$this->field = aMockDateWithoutTimeField()->withId(07)->build();
$this->date_formatter = new Tracker_FormElement_DateTimeFormatter($this->field);
$user = stub('PFUser')->getPreference('user_csv_dateformat')->returns('');
$user_manager = stub('UserManager')->getCurrentUser()->returns($user);
UserManager::setInstance($user_manager);
}
示例9: setUp
public function setUp()
{
parent::setUp();
EventManager::setInstance(mock('EventManager'));
ProjectManager::setInstance(mock('ProjectManager'));
$this->user_manager = mock('UserManager');
UserManager::setInstance($this->user_manager);
$this->rm = partial_mock('ReferenceManager', array('_getReferenceDao', '_getCrossReferenceDao', 'loadReservedKeywords', 'getGroupIdFromArtifactIdForCallbackFunction', 'getGroupIdFromArtifactId'));
$this->rm->__construct();
}
示例10: setUp
public function setUp()
{
parent::setUp();
$user_manager = stub('UserManager')->getCurrentUser()->returns(mock('PFUser'));
UserManager::setInstance($user_manager);
$this->project_manager = mock('ProjectManager');
$this->url_verification = mock('URLVerification');
$this->result_factory = new ElasticSearch_1_2_ResultFactory($this->project_manager, $this->url_verification, $user_manager);
$this->serach_data = array('took' => 2, 'timed_out' => false, '_shards' => array('total' => 1, 'successful' => 1, 'failed' => 0), 'hits' => array('total' => 2, 'max_score' => 1.3838634, 'hits' => array(0 => array('_index' => 'tuleap', '_type' => 'tracker', '_id' => '3923', '_score' => 1.3838634, 'fields' => array('group_id' => array(0 => 116), 'id' => array(0 => 22), 'last_changeset_id' => array(0 => 3923))), 1 => array('_index' => 'tuleap', '_type' => 'tracker', '_id' => '3923', '_score' => 1.3838634, 'fields' => array('group_id' => array(0 => 116), 'id' => array(0 => 23), 'last_changeset_id' => array(0 => 3924))))), 'time' => 0.0044469833374023);
}
示例11: setUp
public function setUp()
{
parent::setUp();
ForgeConfig::store();
ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..');
$this->user_manager = mock('UserManager');
$this->request = mock('Codendi_Request');
$this->planning_factory = mock('PlanningFactory');
$this->kanban_manager = mock('AgileDashboard_KanbanManager');
$this->config_manager = mock('AgileDashboard_ConfigurationManager');
$this->tracker_factory = mock('TrackerFactory');
$this->kanban_factory = mock('AgileDashboard_KanbanFactory');
UserManager::setInstance($this->user_manager);
}
示例12: setUp
public function setUp()
{
$GLOBALS['Language'] = new ProjectCreatorTest_BaseLanguage();
$this->event_manager = new MockSystemEventManager();
$this->event_manager->setReturnValue('isUserNameAvailable', true);
$this->event_manager->setReturnValue('isProjectNameAvailable', true);
SystemEventManager::setInstance($this->event_manager);
$this->project_manager = new MockProjectManager();
$this->project_manager->setReturnValue('getProjectByUnixName', null);
ProjectManager::setInstance($this->project_manager);
$this->user_manager = new MockUserManager();
$this->user_manager->setReturnValue('getUserByUserName', null);
UserManager::setInstance($this->user_manager);
}
示例13: setUp
function setUp()
{
parent::setUp();
ForgeConfig::store();
ForgeConfig::set(ForgeAccess::CONFIG, ForgeAccess::ANONYMOUS);
$GLOBALS['Response'] = mock('Layout');
$GLOBALS['sys_default_domain'] = 'default';
$GLOBALS['sys_https_host'] = 'default';
$GLOBALS['sys_force_ssl'] = 0;
unset($GLOBALS['group_id']);
$this->fixtures = dirname(__FILE__) . '/_fixtures';
$GLOBALS['Language'] = new MockBaseLanguage($this);
$this->user = mock('PFUser');
$this->user_manager = mock('UserManager');
stub($this->user_manager)->getCurrentUser()->returns($this->user);
UserManager::setInstance($this->user_manager);
}
示例14: setUp
public function setUp()
{
$this->old_cwd = getcwd();
$this->system_command = new System_Command();
parent::setUp();
$this->old_sys_data_dir = $GLOBALS['sys_data_dir'];
$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->git_manager = new GitRepositoryManager($this->git_factory, $this->git_systemeventmanager, $this->git_dao, parent::getTmpDir());
$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, null, 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));
}
示例15: setUp
public function setUp()
{
parent::setUp();
$GLOBALS['ftp_frs_dir_prefix'] = 'whatever';
$GLOBALS['ftp_anon_dir_prefix'] = 'whatever';
$GLOBALS['svn_prefix'] = 'whatever';
$GLOBALS['cvs_prefix'] = 'whatever';
$GLOBALS['grpdir_prefix'] = 'whatever';
$template = stub('Project')->isTemplate()->returns(true);
$user_manager = mock('UserManager');
UserManager::setInstance($user_manager);
$project_manager = mock('ProjectManager');
ProjectManager::setInstance($project_manager);
stub($project_manager)->getProject($this->template_id)->returns($template);
$system_event_manager = mock('SystemEventManager');
SystemEventManager::setInstance($system_event_manager);
stub($system_event_manager)->isUserNameAvailable()->returns(true);
stub($system_event_manager)->isProjectNameAvailable()->returns(true);
}