* Refactor addProjectMembers method.

This commit is contained in:
tianshujie
2023-09-01 09:16:08 +08:00
parent 19ad64d83e
commit 3d2b686c78
3 changed files with 21 additions and 28 deletions
+8 -9
View File
@@ -1764,27 +1764,26 @@ class executionTest
* function addProjectMembers test by execution
*
* @param int $projectID
* @param string $executionID
* @param string $count
* @param int $executionID
* @param int $count
* @access public
* @return array
* @return array|int
*/
public function addProjectMembersTest($projectID = 0, $executionID = 0, $count = 0)
public function addProjectMembersTest(int $projectID = 0, int $executionID = 0, int $count = 0): array|int
{
global $tester;
$tester->dbh->query("delete from zt_team where root = $projectID");
$executionMembers = $tester->dao->select('`root`,`account`,`join`,`role`,`days`,`type`,`hours`')->from(TABLE_TEAM)->where('root')->eq($executionID)->fetchAll('account');
$this->executionModel->dao->delete()->from(TABLE_TEAM)->where('root')->eq($projectID)->exec();
$executionMembers = $this->executionModel->dao->select('`root`,`account`,`join`,`role`,`days`,`type`,`hours`')->from(TABLE_TEAM)->where('root')->eq($executionID)->fetchAll('account');
$this->executionModel->addProjectMembers($projectID, $executionMembers);
$object = $tester->dao->select('*')->from(TABLE_TEAM)->where('root')->eq($projectID)->fetchAll();
$object = $this->executionModel->dao->select('*')->from(TABLE_TEAM)->where('root')->eq($projectID)->fetchAll();
if(dao::isError())
{
$error = dao::getError();
return $error;
}
elseif($count == "1")
elseif($count == 1)
{
return count($object);
}