本文整理汇总了PHP中PermissionsManager::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionsManager::setInstance方法的具体用法?PHP PermissionsManager::setInstance怎么用?PHP PermissionsManager::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionsManager
的用法示例。
在下文中一共展示了PermissionsManager::setInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
PermissionsManager::setInstance(mock('PermissionsManager'));
$this->xml_security = new XML_Security();
$this->xml_security->enableExternalLoadOfEntities();
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->from = aFieldListStaticValue()->withId(123)->build();
$this->to = aFieldListStaticValue()->withId(456)->build();
PermissionsManager::setInstance(mock('PermissionsManager'));
}
示例3: setUp
public function setUp()
{
parent::setUp();
PermissionsManager::setInstance(mock('PermissionsManager'));
$this->transition = mock('Transition');
$this->legacy_permissions_xml = new SimpleXMLElement('
<transition>
<permissions>
<permission ugroup="UGROUP_PROJECT_MEMBERS"/>
<permission ugroup="UGROUP_PROJECT_ADMIN"/>
</permissions>
</transition>
');
stub($this->permissions_factory)->getInstanceFromXML($this->legacy_permissions_xml->permissions, $this->xml_mapping, $this->transition)->returns(mock('Workflow_Transition_Condition_Permissions'));
$this->from_5_7_permissions_xml = new SimpleXMLElement('
<transition>
<conditions>
<condition type="perms">
<permissions>
<permission ugroup="UGROUP_PROJECT_MEMBERS"/>
<permission ugroup="UGROUP_PROJECT_ADMIN"/>
</permissions>
</condition>
</conditions>
</transition>
');
stub($this->permissions_factory)->getInstanceFromXML($this->from_5_7_permissions_xml->conditions->condition, $this->xml_mapping, $this->transition)->returns(mock('Workflow_Transition_Condition_Permissions'));
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->permissions_manager = mock('PermissionsManager');
PermissionsManager::setInstance($this->permissions_manager);
$this->transition = stub('Transition')->getId()->returns(123);
$this->permissions_factory = new Workflow_Transition_Condition_Permissions_Factory();
}
示例5: setUp
public function setUp()
{
parent::setUp();
$this->permissions_manager = mock('PermissionsManager');
PermissionsManager::setInstance($this->permissions_manager);
$this->git_permissions_dao = mock('Git_PermissionsDao');
$this->git_system_event_manager = mock('Git_SystemEventManager');
$this->git_permissions_manager = new GitPermissionsManager($this->git_permissions_dao, $this->git_system_event_manager);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->user = stub('PFUser')->getId()->returns(101);
$this->project_id = 202;
$this->permission_manager = stub('PermissionsManager')->getAuthorizedUgroups(303, Workflow_Transition_Condition_Permissions::PERMISSION_TRANSITION)->returns(array(404));
PermissionsManager::setInstance($this->permission_manager);
$this->transition = stub('Transition')->getId()->returns(303);
$this->condition = new Workflow_Transition_Condition_Permissions($this->transition);
}
示例7: setUp
public function setUp()
{
parent::setUp();
$this->project_id++;
$this->repository_id++;
$this->oldCwd = getcwd();
$this->project = new MockProject();
$this->project->setReturnValue('getId', $this->project_id);
$this->project->setReturnValue('getUnixName', 'project' . $this->project_id);
$this->repository = new MockGitRepository();
$this->repository->setReturnValue('getId', $this->repository);
PermissionsManager::setInstance(new MockPermissionsManager());
mkdir($this->admin_dir);
$this->driver = new Git_GitoliteDriver($this->admin_dir);
}
示例8: setUp
public function setUp()
{
parent::setUp();
$this->_fixDir = dirname(__FILE__) . '/_fixtures';
$GLOBALS['sys_https_host'] = 'localhost';
PermissionsManager::setInstance(mock('PermissionsManager'));
$this->permissions_manager = PermissionsManager::instance();
$this->repository_factory = mock('GitRepositoryFactory');
$git_plugin = stub('GitPlugin')->areFriendlyUrlsActivated()->returns(false);
$this->url_manager = new Git_GitRepositoryUrlManager($git_plugin);
$mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper');
stub($mirror_data_mapper)->fetchAllRepositoryMirrors()->returns(array());
stub($mirror_data_mapper)->fetchAll()->returns(array());
$this->gitolite_permissions_serializer = new Git_Gitolite_ConfigPermissionsSerializer($mirror_data_mapper, 'whatever');
$this->logger = mock('Logger');
$this->project_serializer = new Git_Gitolite_ProjectSerializer($this->logger, $this->repository_factory, $this->gitolite_permissions_serializer, $this->url_manager);
}
示例9: setUp
public function setUp()
{
parent::setUp();
$this->literalizer = new UGroupLiteralizer();
$this->docman_item = new Docman_Item();
$this->docman_item->setId($this->item_id);
$this->permissions_manager = mock('PermissionsManager');
$this->project_manager = mock('ProjectManager');
$this->project = mock('Project');
$this->docman_permissions = new Docman_PermissionsItemManager();
stub($this->project_manager)->getProject()->returns($this->project);
stub($this->project)->getUnixName()->returns('gpig');
stub($this->project)->getID()->returns($this->uniqId());
PermissionsManager::setInstance($this->permissions_manager);
ProjectManager::setInstance($this->project_manager);
Docman_ItemFactory::setInstance($this->project->getID(), mock('Docman_ItemFactory'));
}
示例10: setUp
public function setUp()
{
parent::setUp();
$this->cwd = getcwd();
$this->_fixDir = dirname(__FILE__) . '/_fixtures';
$tmpDir = '/tmp';
$this->_glAdmDirRef = $tmpDir . '/gitolite-admin-ref';
$this->_glAdmDir = $tmpDir . '/gitolite-admin';
$this->repoDir = $tmpDir . '/repositories';
// Copy the reference to save time & create symlink because
// git is very sensitive to path you are using. Just symlinking
// spots bugs
system('tar -xf ' . $this->_fixDir . '/gitolite-admin-ref' . '.tar --directory ' . $tmpDir);
symlink($this->_glAdmDirRef, $this->_glAdmDir);
mkdir($this->repoDir);
$this->httpsHost = $GLOBALS['sys_https_host'];
$GLOBALS['sys_https_host'] = 'localhost';
PermissionsManager::setInstance(new MockPermissionsManager());
$this->gitExec = partial_mock('Git_Exec', array('push'), array($this->_glAdmDir));
stub($this->gitExec)->push()->returns(true);
$this->driver = new Git_GitoliteDriver($this->_glAdmDir, $this->gitExec);
}
示例11: setUp
public function setUp()
{
$package_factory = new FRSPackageFactoryMock();
$release_factory = new FRSReleaseFactory();
$file_factory = new FRSXMLImporterTest_FRSFileFactory();
$this->package_dao = mock('FRSPackageDao');
$package_factory->dao = $this->package_dao;
FRSPackageFactory::setInstance($package_factory);
$this->permissions_manager = mock('PermissionsManager');
PermissionsManager::setInstance($this->permissions_manager);
$this->release_dao = mock('FRSReleaseDao');
$release_factory->dao = $this->release_dao;
$release_factory->package_factory = $package_factory;
$release_factory->file_factory = $file_factory;
FRSReleaseFactory::setInstance($release_factory);
$this->file_dao = mock('FRSFileDao');
$file_factory->dao = $this->file_dao;
$file_factory->release_factory = $release_factory;
$this->processor_dao = mock('FRSProcessorDao');
$this->filetype_dao = mock('FRSFileTypeDao');
$this->user_finder = mock('User\\XML\\Import\\IFindUserFromXMLReference');
$this->user_manager = mock('UserManager');
UserManager::setInstance($this->user_manager);
$this->ugroup_dao = mock("UGroupDao");
stub($this->ugroup_dao)->searchByGroupIdAndName()->returns(new DataAccessResultEmpty());
$this->frs_importer = new FRSXMLImporter(mock('Logger'), new XML_RNGValidator(), $package_factory, $release_factory, $file_factory, $this->user_finder, new UGroupManager($this->ugroup_dao), $this->processor_dao, $this->filetype_dao);
EventManager::setInstance(mock('EventManager'));
$GLOBALS['Language'] = mock('BaseLanguage');
if (isset($GLOBALS['ftp_incoming_dir'])) {
$this->old_ftp_incoming_dir = $GLOBALS['ftp_incoming_dir'];
}
if (isset($GLOBALS['old_ftp_frs_dir_prefix'])) {
$this->old_ftp_frs_dir_prefix = $GLOBALS['ftp_frs_dir_prefix'];
}
$GLOBALS['ftp_incoming_dir'] = parent::getTmpDir();
$GLOBALS['ftp_frs_dir_prefix'] = parent::getTmpDir();
}
示例12: setUp
public function setUp()
{
parent::setUp();
$this->cwd = getcwd();
$this->_fixDir = dirname(__FILE__) . '/_fixtures';
$tmpDir = $this->getTmpDir();
$this->_glAdmDirRef = $tmpDir . '/gitolite-admin-ref';
$this->sys_data_dir = $tmpDir;
$this->_glAdmDir = $tmpDir . '/gitolite/admin';
$this->repoDir = $tmpDir . '/repositories';
// Copy the reference to save time & create symlink because
// git is very sensitive to path you are using. Just symlinking
// spots bugs
mkdir($tmpDir . '/gitolite');
system('tar -xf ' . $this->_fixDir . '/gitolite-admin-ref' . '.tar --directory ' . $tmpDir);
symlink($this->_glAdmDirRef, $this->_glAdmDir);
mkdir($this->repoDir);
$GLOBALS['sys_https_host'] = 'localhost';
$GLOBALS['sys_data_dir'] = $this->sys_data_dir;
PermissionsManager::setInstance(new MockPermissionsManager());
$this->permissions_manager = PermissionsManager::instance();
$this->gitExec = partial_mock('Git_Exec', array('push'), array($this->_glAdmDir));
stub($this->gitExec)->push()->returns(true);
$this->user_manager = mock('UserManager');
$this->dumper = new Git_Gitolite_SSHKeyDumper($this->_glAdmDir, $this->gitExec);
$this->repository_factory = mock('GitRepositoryFactory');
$git_plugin = stub('GitPlugin')->areFriendlyUrlsActivated()->returns(false);
$this->url_manager = new Git_GitRepositoryUrlManager($git_plugin);
$this->mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper');
stub($this->mirror_data_mapper)->fetchAllRepositoryMirrors()->returns(array());
stub($this->mirror_data_mapper)->fetchAll()->returns(array());
$this->gitolite_permissions_serializer = new Git_Gitolite_ConfigPermissionsSerializer($this->mirror_data_mapper, mock('Git_Driver_Gerrit_ProjectCreatorStatus'), 'whatever');
$this->git_system_event_manager = mock('Git_SystemEventManager');
$this->logger = mock('Logger');
$this->driver = new Git_GitoliteDriver($this->logger, $this->git_system_event_manager, $this->url_manager, mock('GitDao'), mock('Git_Mirror_MirrorDao'), mock('GitPlugin'), $this->gitExec, $this->repository_factory, $this->gitolite_permissions_serializer, null, null, $this->mirror_data_mapper);
}
示例13: setUp
public function setUp()
{
parent::setUp();
$this->mirror_mapper = mock('Git_Mirror_MirrorDataMapper');
$this->serializer = new Git_Gitolite_ConfigPermissionsSerializer($this->mirror_mapper, 'whatever');
$this->project = stub('Project')->getUnixName()->returns('foo');
$this->repository = aGitRepository()->withId(115)->withProject($this->project)->build();
$user_mirror1 = aUser()->withUserName('git_mirror_1')->build();
$this->mirror_1 = new Git_Mirror_Mirror($user_mirror1, 1, 'url', 'hostname', 'EUR');
$user_mirror2 = aUser()->withUserName('git_mirror_2')->build();
$this->mirror_2 = new Git_Mirror_Mirror($user_mirror2, 2, 'url', 'hostname', 'IND');
$this->permissions_manager = mock('PermissionsManager');
PermissionsManager::setInstance($this->permissions_manager);
}
示例14: itCanReturnUgroupIdsFromAnItemAndItsPermissionTypes
public function itCanReturnUgroupIdsFromAnItemAndItsPermissionTypes()
{
$object_id = 100;
$expected = array(Ugroup::PROJECT_MEMBERS);
$permissions_manager = mock('PermissionsManager');
stub($permissions_manager)->getAuthorizedUgroupIds($object_id, self::PERMISSIONS_TYPE)->returns($expected);
PermissionsManager::setInstance($permissions_manager);
$result = $this->ugroup_literalizer->getUgroupIds($object_id, self::PERMISSIONS_TYPE);
$this->assertEqual($expected, $result);
PermissionsManager::clearInstance();
}
示例15: setUp
public function setUp()
{
parent::setUp();
$project = mock('Project');
stub($project)->getId()->returns(102);
stub($project)->getUnixName()->returns('gpig');
$this->repository = mock('GitRepository');
stub($this->repository)->getId()->returns(1001);
stub($this->repository)->getProject()->returns($project);
PermissionsManager::setInstance(mock('PermissionsManager'));
$this->permissions_manager = PermissionsManager::instance();
stub($this->permissions_manager)->getAuthorizedUGroupIdsForProject('*', '*', Git::PERM_READ)->returns(array(ProjectUGroup::REGISTERED));
stub($this->permissions_manager)->getAuthorizedUGroupIdsForProject('*', '*', Git::PERM_WRITE)->returns(array(ProjectUGroup::PROJECT_MEMBERS));
stub($this->permissions_manager)->getAuthorizedUGroupIdsForProject('*', '*', Git::PERM_WPLUS)->returns(array());
$this->gerrit_status = mock('Git_Driver_Gerrit_ProjectCreatorStatus');
$user_mirror1 = aUser()->withUserName('git_mirror_1')->build();
$this->mirror_1 = new Git_Mirror_Mirror($user_mirror1, 1, 'url', 'hostname', 'EUR');
$this->serializer = new Git_Gitolite_ConfigPermissionsSerializer(stub('Git_Mirror_MirrorDataMapper')->fetchAllRepositoryMirrors()->returns(array()), $this->gerrit_status, 'whatever');
}