Beispiel #1
0
 function testCheckRestrictedAccessUserIsMember()
 {
     $GLOBALS['sys_allow_restricted_users'] = 1;
     $pm = new ProjectManagerTestVersion();
     $um = new MockUserManager();
     $user = new MockUser();
     $user->setReturnValue('isRestricted', true);
     $um->setReturnValue('getCurrentUser', $user);
     $pm->setReturnValue('_getUserManager', $um);
     $project = new MockProject();
     $project->setReturnValue('userIsMember', true);
     $this->assertTrue($pm->checkRestrictedAccess($project));
     $pm->expectOnce('_getUserManager');
 }
 function testRename()
 {
     $p1 = new MockProject($this);
     $p1->setReturnValue('getId', '1');
     $p1->setReturnValue('getUnixName', 'one');
     $pm = new ProjectManagerTestVersion($this);
     $pm->setReturnValue('createProjectInstance', $p1);
     $pm->getProject(1);
     $dao = new MockProjectDao($this);
     $dao->setReturnValue('renameProject', true, array($p1, 'TestProj'));
     $pm->setReturnValue('_getDao', $dao);
     $this->assertTrue($pm->renameProject($p1, 'TestProj'));
     $this->assertFalse($pm->isCached($p1->getId()));
 }