Exemplo n.º 1
0
 protected function _userCanReadWhenNoPermsOnRelease($canReadPackage)
 {
     // Setup test
     $frsrf = new FRSReleaseFactoryTestVersion($this);
     // User
     $user = mock('PFUser');
     $user->setReturnValue('getId', $this->user_id);
     $um = new MockUserManager($this);
     $um->setReturnValue('getUserById', $user);
     $frsrf->setReturnValue('getUserManager', $um);
     // Perms
     $pm = new MockPermissionsManager($this);
     $pm->expectOnce('isPermissionExist', array($this->release_id, 'RELEASE_READ'));
     $pm->setReturnValue('isPermissionExist', false);
     $frsrf->setReturnValue('getPermissionsManager', $pm);
     // PackageFactory
     $frspf = new MockFRSPackageFactory($this);
     $frspf->expectOnce('userCanRead', array($this->group_id, $this->package_id, $this->user_id));
     $frspf->setReturnValue('userCanRead', $canReadPackage);
     $frsrf->setReturnValue('_getFRSPackageFactory', $frspf);
     return $frsrf;
 }
Exemplo n.º 2
0
 function testGetGroupIdWithoutProjectSet()
 {
     $r = new FRSReleaseTestVersion($this);
     $r->setPackageId(696);
     $pkg = new FRSPackage(array('group_id' => 123));
     $pf = new MockFRSPackageFactory($this);
     $pf->expectOnce('getFRSPackageFromDb', array(696, null, FRSPackageDao::INCLUDE_DELETED));
     $pf->setReturnValue('getFRSPackageFromDb', $pkg);
     $r->setReturnValue('_getFRSPackageFactory', $pf);
     $this->assertEqual($r->getGroupID(), 123);
 }