/** * Check if an group is in the project * * @param USVN_Db_Table_Row_Group Group * @return boolean */ public function groupIsMember(USVN_Db_Table_Row_Group $group) { $table = new USVN_Db_Table_GroupsToProjects(); $res = $table->fetchRow(array("groups_id = ?" => $group->id, "projects_id = ?" => $this->id)); if ($res === null) { return false; } return true; }
private function CheckCreateProjectWithGroupWithAdmin($project) { $table = new USVN_Db_Table_Projects(); $this->assertTrue($table->isAProject('InsertProjectOk'), "Le projet n'est pas cree"); $this->assertTrue(USVN_SVNUtils::isSVNRepository('tests/tmp/svn/InsertProjectOk'), "Le repository n'est pas cree"); $table = new USVN_Db_Table_Groups(); $this->assertTrue($table->isAGroup('InsertProjectOk'), "Le groupe n'est pas cree"); $group = $table->fetchRow(array("groups_name = ?" => 'InsertProjectOk')); $table = new USVN_Db_Table_GroupsToProjects(); $groupstoprojects = $table->fetchRow(array("projects_id = ?" => $project->id, "groups_id = ?" => $group->id)); $this->assertNotNull($groupstoprojects); $this->assertTrue($group->hasUser($this->_user), "L'utilisateur n'est pas membre du groupe " . $group->name); $this->assertTrue($group->userIsGroupLeader($this->_user), "User is not leader of group " . $group->name); $this->assertTrue($project->userIsAdmin($this->_user)); return $group; }