Example #1
0
 public function testRenameSVNRepository()
 {
     $project = new MockProject($this);
     $project->setReturnValue('getUnixNameMixedCase', 'TestProj');
     $project->setReturnValue('getSVNRootPath', $GLOBALS['svn_prefix'] . '/TestProj');
     $project->setReturnValue('isSVNTracked', false);
     $project->setReturnValue('getMembersUserNames', array());
     $pm = new MockProjectManager();
     $pm->setReturnReference('getProject', $project, array(142));
     $ugdao = new MockUGroupDao();
     $ugdao->setReturnValue('searchByGroupId', array());
     $backend = new BackendSVNTestVersion($this);
     $backend->setReturnValue('getProjectManager', $pm);
     $backend->setReturnValue('getUGroupDao', $ugdao);
     $backend->createProjectSVN(142);
     $this->assertEqual($backend->renameSVNRepository($project, "foobar"), true);
     $this->assertTrue(is_dir($GLOBALS['svn_prefix'] . "/foobar"), "SVN dir should be renamed");
     // Cleanup
     $backend->recurseDeleteInDir($GLOBALS['svn_prefix'] . "/foobar");
     rmdir($GLOBALS['svn_prefix'] . "/foobar");
 }
Example #2
0
 public function itverifiesUserGroupMembersAreProjectMembersWhenProjectIsPrivate()
 {
     $user1 = mock('PFUser');
     $user1->setReturnValue('getUserName', 'user1');
     $user2 = mock('PFUser');
     $user2->setReturnValue('getUserName', 'user2');
     $project = new MockProject($this);
     $project->setReturnValue('getMembers', array($user2));
     $project->setReturnValue('isPublic', false);
     $usergroup_dao = new MockUGroupDao();
     $usergroup_dao->setReturnValue('searchByGroupId', array(array('name' => 'Perms')));
     $this->backend->setReturnValue('getUGroupDao', $usergroup_dao);
     $ugroup = new MockProjectUGroup($this);
     $ugroup->setReturnValue('getMembers', array($user1, $user2));
     $ugroup->setReturnValue('getName', 'Perms');
     $this->backend->setReturnValue('getUGroupFromRow', $ugroup);
     $ugroup_members_line = $this->backend->getSVNAccessUserGroupMembers($project);
     $this->assertEqual($ugroup_members_line, "Perms = user2\n\n");
 }
Example #3
0
 function testGetAllProjectShouldListOnlyOneOccurenceOfEachProject()
 {
     $user = TestHelper::getPartialMock('User', array('getProjects', 'getUGroupDao'));
     $user->setReturnValue('getProjects', array(101, 103));
     $dar = TestHelper::arrayToDar(array('group_id' => 102), array('group_id' => 103), array('group_id' => 104));
     $dao = new MockUGroupDao();
     $dao->setReturnValue('searchGroupByUserId', $dar);
     $user->setReturnValue('getUGroupDao', $dao);
     $this->assertEqual(array(102, 103, 104, 101), $user->getAllProjects());
 }