diff --git a/test/model/project/activate.php b/test/model/project/activate.php new file mode 100755 index 0000000000..a82950d3a1 --- /dev/null +++ b/test/model/project/activate.php @@ -0,0 +1,51 @@ +#!/usr/bin/env php +project = $tester->loadModel('project'); + } + + /** + * checkStatus + * + * @param int $projectID + * @access public + * @return bool + */ + public function checkStatus($projectID) + { + $oldProject = $this->project->getById($projectID); + if($oldProject->status != 'closed') return false; + + $change = $this->project->activate($projectID); + + $project = $this->project->getById($projectID); + if($project->status != 'doing') return false; + + return true; + } +} + +$t = new Tester('admin'); + +/* Activate($projectID). */ +r($t->checkStatus(66)) && p() && e('1'); //开始id为66状态不是closed的项目 +r($t->checkStatus(67)) && p() && e('0'); //开始id为67状态是closed的项目 diff --git a/test/model/project/checkHasChildren.php b/test/model/project/checkHasChildren.php index de4e9c86f6..8f2b16dd7b 100755 --- a/test/model/project/checkHasChildren.php +++ b/test/model/project/checkHasChildren.php @@ -20,6 +20,13 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * checkHasChildren + * + * @param int $projectID + * @access public + * @return bool + */ public function checkHasChildren($projectID) { return $this->project->checkHasChildren($projectID); @@ -28,5 +35,6 @@ class Tester $t = new Tester('admin'); +/* CheckHasChildren($projectID). */ r($t->checkHasChildren(1)) && p() && e('1'); //获取id为1的项目是否有子项目 r($t->checkHasChildren(101)) && p() && e('0'); //获取id为101的项目是否有子项目 diff --git a/test/model/project/close.php b/test/model/project/close.php index 0ed0d7b01e..073ae53e17 100755 --- a/test/model/project/close.php +++ b/test/model/project/close.php @@ -23,10 +23,17 @@ class Tester $this->project = $tester->loadModel('project'); } - public function checkStatus($projectID, $realEnd) + /** + * checkStatus + * + * @param int $projectID + * @access public + * @return bool + */ + public function checkStatus($projectID) { $oldProject = $this->project->getById($projectID); - if($oldProject->status == 'closed') return false; + if($oldProject->status == 'suspended' or $oldProject->status == 'closed') return false; $change = $this->project->close($projectID); @@ -39,5 +46,7 @@ class Tester $t = new Tester('admin'); -r($t->checkStatus(20)) && p() && e('1'); //关闭一个状态不是closed的项目 -r($t->checkStatus(26)) && p() && e('0'); //关闭一个状态是closed的项目 +/* Close($projectID). */ +r($t->checkStatus(20)) && p() && e('1'); //关闭id为20状态不是closed的项目 +r($t->checkStatus(26)) && p() && e('0'); //关闭id为26状态是closed的项目 +r($t->checkStatus(41)) && p() && e('0'); //关闭id为41状态是suspended的项目 diff --git a/test/model/project/getBudgetUnitList.php b/test/model/project/getBudgetUnitList.php index 95d12d6be2..5d580a8181 100755 --- a/test/model/project/getBudgetUnitList.php +++ b/test/model/project/getBudgetUnitList.php @@ -19,6 +19,14 @@ class Tester su($user); $this->project = $tester->loadModel('project'); } + + /** + * checkBudgetUnitList + * + * @param string $checkList + * @access public + * @return bool + */ public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元')) { $budgetList = $this->project->getBudgetUnitList(); @@ -32,4 +40,5 @@ class Tester $t = new Tester('admin'); +/* GetBudgetUnitList(). */ r($t->checkBudgetUnitList()) && p() && e('1'); //检查翻译 diff --git a/test/model/project/getByIdList.php b/test/model/project/getByIdList.php index 30e19ade84..f35c53f07f 100755 --- a/test/model/project/getByIdList.php +++ b/test/model/project/getByIdList.php @@ -21,6 +21,14 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * getByIdList + * + * @param array $projectIdList + * @param int $count + * @access public + * @return array + */ public function getByIdList($projectIdList, $count) { $projectList = $this->project->getByIdList($projectIdList); @@ -32,4 +40,5 @@ class Tester $t = new Tester('admin'); $projectIdList = array(11,12,13); +/* GetByIdList($projectIdList). */ r(($t->getByIdList($projectIdList, 3))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称 diff --git a/test/model/project/getDataByProject.php b/test/model/project/getDataByProject.php index 6779ac7f9d..0b2678caba 100755 --- a/test/model/project/getDataByProject.php +++ b/test/model/project/getDataByProject.php @@ -20,6 +20,14 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * getExecutionData + * + * @param int $projectID + * @param int $type + * @access public + * @return array + */ public function getExecutionData($projectID, $type) { $result = $this->project->getDataByProject(TABLE_EXECUTION, $projectID, $type); @@ -27,6 +35,13 @@ class Tester return $result; } + /** + * getBuildData + * + * @param int $projectID + * @access public + * @return array + */ public function getBuildData($projectID) { $result = $this->project->getDataByProject(TABLE_BUILD, $projectID); @@ -34,6 +49,13 @@ class Tester return $result; } + /** + * getRealseData + * + * @param int $projectID + * @access public + * @return array + */ public function getRealseData($projectID) { $result = $this->project->getDataByProject(TABLE_RELEASE, $projectID); diff --git a/test/model/project/getParentName.php b/test/model/project/getParentName.php index 85b2f9eaca..f20acb33be 100755 --- a/test/model/project/getParentName.php +++ b/test/model/project/getParentName.php @@ -20,6 +20,13 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * getParentName + * + * @param int $projectID + * @access public + * @return array + */ public function getParentName($projectID) { $program = $this->project->getParentName($projectID); @@ -30,6 +37,7 @@ class Tester $t = new Tester('admin'); +/* GetParentName($projectID). */ r($t->getParentName(11)) && p('name') && e('项目集1'); //获取id为11的项目父项目名字 r($t->getParentName(1)) && p('name') && e('项目集1'); //获取id为1的项目父项目名字 r($t->getParentName(0)) && p('name') && e('0'); //获取id为0的项目父项目名字 diff --git a/test/model/project/getStats.php b/test/model/project/getStats.php index d0d55ee7df..38fcd5bb53 100755 --- a/test/model/project/getStats.php +++ b/test/model/project/getStats.php @@ -20,6 +20,13 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * getByStatus + * + * @param string $status + * @access public + * @return int + */ public function getByStatus($status) { $executions = $this->project->getStats(0, $status); @@ -34,6 +41,13 @@ class Tester return count($executions); } + /** + * getByProject + * + * @param int $projectID + * @access public + * @return int + */ public function getByProject($projectID) { $executions = $this->project->getStats($projectID, 'all'); @@ -45,6 +59,13 @@ class Tester return count($executions); } + /** + * getListByOrder + * + * @param string $orderBy + * @access public + * @return bool + */ public function getListByOrder($orderBy) { $executions = $this->project->getStats(0, 'all', 0, 0, 30, $orderBy); diff --git a/test/model/project/getTeamMemberPairs.php b/test/model/project/getTeamMemberPairs.php index aa5db265f2..061dc596fa 100755 --- a/test/model/project/getTeamMemberPairs.php +++ b/test/model/project/getTeamMemberPairs.php @@ -23,6 +23,13 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * getTeamMemberPairs + * + * @param int $projectID + * @access public + * @return int + */ public function getTeamMemberPairs($projectID) { $members = array_filter($this->project->getTeamMemberPairs($projectID)); @@ -33,5 +40,6 @@ class Tester $t = new Tester('admin'); +/* GetTeamMemberPairs($projectID). */ r($t->getTeamMemberPairs(11)) && p() && e('2'); //获取id为11的项目团队成员个数 r($t->getTeamMemberPairs(1)) && p() && e('0'); //获取id为1的项目团队成员个数 diff --git a/test/model/project/getTeamMembers.php b/test/model/project/getTeamMembers.php index cbfc74cc83..a8678d6521 100755 --- a/test/model/project/getTeamMembers.php +++ b/test/model/project/getTeamMembers.php @@ -23,6 +23,14 @@ class Tester $this->project = $tester->loadModel('project'); } + /** + * checkMembers + * + * @param array $members + * @param array $users + * @access public + * @return bool + */ public function checkMembers($members, $users) { foreach($users as $user) @@ -32,6 +40,15 @@ class Tester return true; } + /** + * getTeamMembers + * + * @param int $projectID + * @param array $users + * @param bool $tutorial + * @access public + * @return int + */ public function getTeamMembers($projectID, $users, $tutorial = false) { if($tutorial) define('TUTORIAL', true); @@ -44,5 +61,6 @@ class Tester $t = new Tester('admin'); +/* GetTeamMembers($projectID). */ r($t->getTeamMembers(11, array('admin', 'pm92'))) && p() && e('2'); //获取id为11的项目团队成员个数 r($t->getTeamMembers(11, array('admin'), true)) && p() && e('1'); //获取id为11的项目团队成员个数,开启新手引导 diff --git a/test/model/project/suspend.php b/test/model/project/suspend.php new file mode 100755 index 0000000000..34054c6e77 --- /dev/null +++ b/test/model/project/suspend.php @@ -0,0 +1,53 @@ +#!/usr/bin/env php +project = $tester->loadModel('project'); + } + + /** + * checkStatus + * + * @param int $projectID + * @access public + * @return bool + */ + public function checkStatus($projectID) + { + $oldProject = $this->project->getById($projectID); + if($oldProject->status == 'suspended' or $oldProject->status == 'closed') return false; + + $change = $this->project->suspend($projectID); + + $project = $this->project->getById($projectID); + if($project->status != 'suspended') return false; + + return true; + } +} + +$t = new Tester('admin'); + +/* Suspend($projectID). */ +r($t->checkStatus(56)) && p() && e('1'); // 暂停id为56状态是doing的项目 +r($t->checkStatus(73)) && p() && e('0'); // 暂停id为73状态是suspended的项目 +r($t->checkStatus(74)) && p() && e('0'); // 暂停id为74状态是closed的项目 +