コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     PermissionsManager::setInstance(mock('PermissionsManager'));
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
コード例 #2
0
ファイル: TransitionTest.php プロジェクト: pombredanne/tuleap
 public function setUp()
 {
     parent::setUp();
     $this->from = aFieldListStaticValue()->withId(123)->build();
     $this->to = aFieldListStaticValue()->withId(456)->build();
     PermissionsManager::setInstance(mock('PermissionsManager'));
 }
コード例 #3
0
 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
0
ファイル: FactoryTest.php プロジェクト: pombredanne/tuleap
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 public function setUp()
 {
     parent::setUp();
     $this->cwd = getcwd();
     $this->_fixDir = dirname(__FILE__) . '/_fixtures';
     $this->_tmpDir = '/tmp';
     $this->_glAdmDirRef = $this->_tmpDir . '/gitolite-admin-ref';
     $this->_glAdmDir = $this->_tmpDir . '/gitolite-admin';
     // 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 ' . $this->_tmpDir);
     symlink($this->_glAdmDirRef, $this->_glAdmDir);
     $this->httpsHost = $GLOBALS['sys_https_host'];
     $GLOBALS['sys_https_host'] = 'localhost';
     PermissionsManager::setInstance(new MockPermissionsManager());
 }
コード例 #11
0
 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);
 }
コード例 #12
0
ファイル: FRSXMLImporterTest.php プロジェクト: blestab/tuleap
 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();
 }
コード例 #13
0
 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);
 }
コード例 #14
0
 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);
 }
コード例 #15
0
 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();
 }
コード例 #16
0
 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');
 }