Ejemplo n.º 1
0
 public function project_removeUsers($userIds)
 {
     return ProjectCommands::removeUsers($this->projectId, $userIds);
 }
 /**
  * @expectedException Exception
  */
 public function testRemoveUsers_ProjectOwner_NotRemovedFromProject()
 {
     self::$environ->clean();
     // setup project and users.  user1 is the project owner
     $project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $projectId = $project->id->asString();
     $user1Id = self::$environ->createUser("user1name", "User1 Name", "*****@*****.**");
     $user2Id = self::$environ->createUser("user2name", "User2 Name", "*****@*****.**");
     $user1 = new UserModel($user1Id);
     $user2 = new UserModel($user2Id);
     $project->addUser($user1->id->asString(), ProjectRoles::CONTRIBUTOR);
     $project->addUser($user2->id->asString(), ProjectRoles::CONTRIBUTOR);
     $project->ownerRef = $user2Id;
     $project->write();
     $user1->addProject($project->id->asString());
     $user1->write();
     $user2->addProject($project->id->asString());
     $user2->write();
     // save data for rest of this test
     self::$save['projectId'] = $projectId;
     self::$save['user1Id'] = $user1Id;
     self::$save['user2Id'] = $user2Id;
     // remove users from project.  user1 still remains as project owner
     $userIds = array($user1->id->asString(), $user2->id->asString());
     self::$environ->inhibitErrorDisplay();
     ProjectCommands::removeUsers($projectId, $userIds);
     // nothing runs in the current test function after an exception. IJH 2014-11
 }