From 9b8f23877947c9ebe781c0b3dfc20ae1a49819e2 Mon Sep 17 00:00:00 2001 From: Zongjun Lan Date: Fri, 11 Mar 2022 17:31:31 +0800 Subject: [PATCH 1/8] * code format --- module/execution/control.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/execution/control.php b/module/execution/control.php index 9d6c0cccaf..4fe9be0e98 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1961,7 +1961,8 @@ class execution extends control { $executionID = $this->execution->saveState((int)$executionID, $this->executions); $execution = $this->execution->getById($executionID, true); - if(empty($execution) || strpos($this->config->vision == 'lite' ? 'kanban' : 'stage,sprint,kanban', $execution->type) === false) return print(js::error($this->lang->notFound) . js::locate('back')); + $type = $this->config->vision == 'lite' ? 'kanban' : 'stage,sprint,kanban'; + if(empty($execution) || strpos($type, $execution->type) === false) return print(js::error($this->lang->notFound) . js::locate('back')); $this->app->loadLang('program'); From f90bdb2a0c9ca6a767c902c0b152785de45b5fe5 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 14 Mar 2022 08:32:03 +0800 Subject: [PATCH 2/8] * Fix bug for feedback. --- extension/lite/feedback/ext/lang/zh-cn/lite.php | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 extension/lite/feedback/ext/lang/zh-cn/lite.php diff --git a/extension/lite/feedback/ext/lang/zh-cn/lite.php b/extension/lite/feedback/ext/lang/zh-cn/lite.php deleted file mode 100644 index bf9c760c27..0000000000 --- a/extension/lite/feedback/ext/lang/zh-cn/lite.php +++ /dev/null @@ -1,6 +0,0 @@ -feedback->typeList = array(); -$lang->feedback->typeList[''] = ''; -$lang->feedback->typeList['story'] = '目标'; -$lang->feedback->typeList['task'] = '任务'; -$lang->feedback->typeList['todo'] = '待办'; \ No newline at end of file From 56c5c966eaac8c66aa7452cb3898d0285b4f105f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 14 Mar 2022 08:55:39 +0800 Subject: [PATCH 3/8] * Modify the problem that the execution label cannot be fully displayed. --- module/execution/css/all.css | 1 + 1 file changed, 1 insertion(+) diff --git a/module/execution/css/all.css b/module/execution/css/all.css index ead807410e..0da2a313bc 100644 --- a/module/execution/css/all.css +++ b/module/execution/css/all.css @@ -23,3 +23,4 @@ td.flex span.project-type-label {margin-left: 5px; min-width: 36px;} .c-percent, .c-realBegan, .c-end, .c-begin, .c-realEnd{width: 100px;} .c-action {text-align: center;} .c-name > span {margin-right: 2px;} +td.flex span.project-type-label {min-width: 40px;} From 81874725635d933843370ff932bac9e3dc6eac9b Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Mon, 14 Mar 2022 09:06:42 +0800 Subject: [PATCH 4/8] * Fix bug #20665. --- module/common/lang/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index b9d8e07423..9957864f95 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -507,7 +507,7 @@ $lang->admin->menuOrder[35] = 'dev'; $lang->admin->menuOrder[40] = 'system'; $lang->admin->menu->message['subMenu'] = new stdclass(); -$lang->admin->menu->message['subMenu']->message = new stdclass(); +$lang->admin->menu->message['subMenu']->message = array(); $lang->admin->menu->message['subMenu']->mail = array('link' => "{$lang->mail->common}|mail|index", 'subModule' => 'mail'); $lang->admin->menu->message['subMenu']->webhook = array('link' => "Webhook|webhook|browse", 'subModule' => 'webhook'); $lang->admin->menu->message['subMenu']->browser = array('link' => "$lang->browser|message|browser"); From 5ac561a33814489c47e7c41492b7d65b6ec295f7 Mon Sep 17 00:00:00 2001 From: "[denghongtao]" <[denghongtao@easycorp.ltd]> Date: Mon, 14 Mar 2022 09:17:47 +0800 Subject: [PATCH 5/8] Update old test --- test/class/product.class.php | 215 +++++++++++++++ test/class/program.class.php | 432 ++++++++++++++++++++++++++++++ test/class/project.class.php | 493 +++++++++++++++++++++++++++++++++++ 3 files changed, 1140 insertions(+) create mode 100644 test/class/product.class.php create mode 100644 test/class/program.class.php create mode 100644 test/class/project.class.php diff --git a/test/class/product.class.php b/test/class/product.class.php new file mode 100644 index 0000000000..d530549d00 --- /dev/null +++ b/test/class/product.class.php @@ -0,0 +1,215 @@ +product = $tester->loadModel('product'); + } + + public function createObject($param = array()) + { + global $createFields; + $whitelist = array(); + $createFields = array('program' => 1, 'line' => 0, 'lineName' => '', 'newLine' => 0, 'name' => '', 'code' => '', 'PO' => 'admin', 'QD' => '', 'RD' => '', + 'reviewer' => '', 'type' => 'normal', 'status' => 'normal', 'desc' => '', 'acl' => 'open', 'uid' => ''); + foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue; + foreach($param as $key => $value) $_POST[$key] = $value; + + //global $tester; + //$objectModel = $tester->loadModel($module); + //$objectID = $this->objectModel->create(); + $objectID = $this->product->create(); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + $object = $this->product->getByID($objectID); + return $object; + } + } + + public function testGetLatestProject($productID) + { + $project = $this->product->getLatestProject($productID); + if($project == false) return '没有数据'; + return $project; + } + + public function getAllProducts($programID) + { + return $this->product->getList($programID); + } + + public function getAllProductsCount($programID) + { + return count($this->getAllProducts($programID)); + } + + public function getNoclosedProducts($programID) + { + return $this->product->getList($programID, 'noclosed'); + } + + public function getNoclosedProductsCount($programID) + { + return count($this->getNoclosedProducts($programID)); + } + + public function getClosedProducts($programID) + { + return $this->product->getList($programID, 'closed'); + } + + public function getClosedProductsCount($programID) + { + return count($this->getClosedProducts($programID)); + } + + public function getInvolvedProducts($programID) + { + return $this->product->getList($programID, 'involved'); + } + + public function getInvolvedProductsCount($programID) + { + return count($this->getInvolvedProducts($programID)); + } + + public function getProductsByLine($programID, $line = 0) + { + return $this->product->getList($programID, 'all', 0, $line); + } + + public function countProductsByLine($programID, $line = 0) + { + return count($this->getProductsByLine($programID, $line)); + } + + public function getProductList($programID, $status = 'all', $line = 0) + { + return $this->product->getList($programID, $status, 0, $line); + } + + public function getProductCount($programID, $status = 'all', $line = 0) + { + return count($this->getProductList($programID, $status, $line)); + } + public function getProductPairs($programID) + { + $pairs = $this->product->getPairs('', $programID); + if($pairs == array()) return '没有数据'; + return $pairs; + } + public function getProductPairsCount($programID) + { + $pairsCount = count($this->getProductPairs($programID)); + if($pairsCount == '没有数据') return '0'; + return $pairsCount; + } + + public function getAllPairs($programID) + { + $pairs = $this->product->getPairs('all', $programID); + if($pairs == array()) return '没有数据'; + return $pairs; + } + public function getAllPairsCount($programID) + { + $pairsCount = count($this->getAllPairs($programID)); + if($pairsCount == '没有数据') return '0'; + return $pairsCount; + } + public function getNoclosedPairs($programID) + { + $pairs = $this->product->getPairs('noclosed', $programID); + if($pairs == array()) return '没有数据'; + return $pairs; + } + public function getNoclosedPairsCount($programID) + { + $pairsCount = count($this->getNoclosedPairs($programID)); + if($pairsCount == '没有数据') return '0'; + return $pairsCount; + } + + public function getProductPairsByOrder($programID, $orderBy = 'id_desc', $mode = '') + { + $this->product->orderBy = $orderBy; + $pairs = $this->product->getPairs($mode, $programID); + return checkOrder($pairs, $orderBy); + } + + public function getAllProjectsByProduct($productID) + { + $projects = $this->product->getProjectListByProduct($productID, 'all'); + if($projects == array()) return '没有数据'; + return $projects; + } + + public function getProjectsByStatus($productID, $status) + { + $projects = $this->product->getProjectListByProduct($productID, $browseType); + if($projects == array()) return '没有数据'; + return $projects; + } + + public function getProjectPairsByProductID($productID) + { + $projects = $this->product->getProjectPairsByProduct($productID, 0, 0); + if($projects == array()) return '没有数据'; + return $projects; + } + + public function getAppendProject($projectID) + { + $project = $this->product->getProjectPairsByProduct(10086, 0, $projectID); + if($project == array()) return '没有数据'; + return $project; + } + + public function testIsClickable($productID, $status) + { + $product = $this->product->getById($productID); + $isClick = $this->product->isClickable($product, $status); + return $isClick == false ? 'false' : 'true'; + } + + public function updateObject($module, $objectID, $param = array()) + { + global $tester; + $objectModel = $tester->loadModel($module); + + $object = $objectModel->getById($objectID); + foreach($object as $field => $value) + { + if(in_array($field, array_keys($param))) + { + $_POST[$field] = $param[$field]; + } + else + { + $_POST[$field] = $value; + } + } + + $change = $objectModel->update($objectID); + if($change == array()) $change = '没有数据更新'; + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $change; + } + } +} diff --git a/test/class/program.class.php b/test/class/program.class.php new file mode 100644 index 0000000000..4ad230b59a --- /dev/null +++ b/test/class/program.class.php @@ -0,0 +1,432 @@ +program = $tester->loadModel('program'); + } + + function create($data) + { + global $app; + + $_POST = ''; + $_POST = $data; + + $programID = $this->program->create(); + + if(dao::isError()) return array('message' => dao::getError()); + + $program = $this->program->getById($programID); + + $app->dbh->query("DELETE FROM ". TABLE_PROGRAM ." where name = '" . $data['name']. "'"); + return $program; + } + function createData($status) + { + $data = array( + 'parent' => 0, + 'name' => '测试新增项目集一', + 'budget' => '', + 'budgetUnit' => 'CNY', + 'begin' => '2022-01-12', + 'end' => '2022-02-12', + 'desc' => '测试项目集描述', + 'acl' => 'private', + 'whitelist' => '' + ); + + switch($status) + { + case '1': // 创建新项目集 + break; + case '2': // 项目集名称为空时 + $data['name'] = ''; + break; + case '3': // 项目集的开始时间为空 + $data['begin'] = ''; + break; + case '4': // 项目集的完成时间为空 + $data['end'] = ''; + break; + case '5': // 项目集的计划完成时间大于计划开始时间 + $data['end'] = '2022-01-10'; + break; + case '6': // 项目集的完成日期大于父项目集的完成日期 + $data['parent'] = '1'; + $data['begin'] = '2018-01-01'; + $data['end'] = '2022-02-10'; + break; + default: + } + return $this->create($data); + } + + public function createStakeholder($programID) + { + $_POST['accounts'] = array('dev1', 'dev2'); + $stakeHolder = $this->program->createStakeholder($programID); + + return $this->program->getStakeholdersByPrograms($programID); + } + + public function getBudgetLeft($programID) + { + $program = $this->program->getById(1); + + return $this->program->getBudgetLeft($program); + } + + public function getBudgetUnitList() + { + global $app; + $app->loadConfig('project'); + $app->loadLang('project'); + + return $this->program->getBudgetUnitList(); + } + + public function getById($programID) + { + if(empty($this->program->getById($programID))) + { + return array('code' => 'fail', 'message' => 'Not Found'); + } + else + { + return $this->program->getById($programID); + } + } + + public function getChildren($programID) + { + $programInfo = $this->program->getChildren($programID); + if(empty($programInfo)) + { + return array('code' => 'fail' , 'message' => 'Not Found'); + } + else + { + return $programInfo; + } + } + + public function getInvolvedPrograms($account) + { + return $this->program->getInvolvedPrograms($account); + } + + public function getPairsByList($programIDList = '') + { + if(empty($this->program->getPairsByList($programIDList))) + { + return array('code' => 'fail', 'message' => 'Not Found'); + } + else + { + return $this->program->getPairsByList($programIDList); + } + } + + public function getPairs() + { + $programs = $this->program->getPairs(); + if(!$programs) return 0; + return $programs; + } + + public function getCount() + { + return count($this->program->getPairs()); + } + + public function getParentPairs() + { + return $this->program->getParentPairs(); + } + + public function getCount1() + { + return count($this->program->getParentPairs()); + } + + public function getParentPM($programIdList) + { + return $this->program->getParentPM($programIdList); + } + + public function getProductPairsByID($programID = 0) + { + $program = $this->program->getByID($programID); + if(empty($program)) return array('message' => 'Not Found'); + return $this->program->getProductPairs($programID, 'assign', 'all'); + } + + public function getProductPairsByMod($mode = 'assign') + { + return $this->program->getProductPairs(1, $mode, 'noclosed'); + } + + public function getProductPairsByStatus($status = 'all') + { + return $this->program->getProductPairs(1, 'assign', $status); + } + + public function getCount2($programID = 0, $mode = 'assign', $status = 'all') + { + return count($this->program->getProductPairs($programID, $mode, $status)); + } + + public function getProgressList() + { + return $this->program->getProgressList(); + } + + public function getCount3() + { + return count($this->program->getProgressList()); + } + + public function getStatsByProgramID($programID = 0) + { + return count($this->program->getProjectStats($programID)); + } + + public function getStatsByStatus($browseType = 'all') + { + $projects = $this->program->getProjectStats('0', $browseType); + + if(!$projects) return 0; + foreach($projects as $project) + { + if($project->status != $browseType and $browseType != 'all' and $browseType != 'undone') return 0; + if($browseType == 'undone' and ($project->status != ('wait' or 'doing'))) return 0; + } + + return count($projects); + } + + public function getStatsByOrder($orderBy = 'id_desc') + { + $projects = $this->program->getProjectStats('0', 'all', '0', $orderBy); + + return checkOrder($projects, $orderBy); + } + + public function getStatsAddProgramTitle($programTitle = 0) + { + return $this->program->getProjectStats('0', 'all', '0', 'id_desc', '', $programTitle); + } + + public function getStatsByInvolved($involved = 0, $count = '') + { + $projects = $this->program->getProjectStats('0', 'all', '0', 'id_desc', '', '0', $involved); + + if($count == 'count') return count($projects); + return $projects; + } + + public function getByPrograms($programIdList = 0) + { + $stakeHolders = $this->program->getStakeholdersByPrograms($programIdList); + + return $stakeHolders; + } + + public function getCount4($programIdList = 0) + { + $stakeHolders = $this->program->getStakeholdersByPrograms($programIdList); + + return count($stakeHolders); + } + + public function getByID1($programID = 0) + { + $stakeholders = $this->program->getStakeholders($programID); + + return $stakeholders; + } + + public function getByOrder($orderBy = 'id_desc') + { + $stakeholders = $this->program->getStakeholders(2, $orderBy); + + return checkOrder($stakeholders, $orderBy); + } + + public function getCount5($programID = 0) + { + $stakeholders = $this->program->getStakeholders($programID); + + return count($stakeholders); + } + + public function getById2($programID) + { + if(empty($this->program->getTeamMemberPairs($programID))) + { + return array('code' => 'fail', 'message' => 'Not Found'); + } + else + { + return $this->program->getTeamMemberPairs($programID); + } + } + + public function getCount6($programID) + { + return count($this->program->getTeamMemberPairs($programID)); + } + + public function getById3($programID = 0) + { + if(empty($this->program->getTopById($programID))) + { + return array('code' => 'fail', 'message' => 'Not Found'); + } + else + { + return $this->program->getByTopId($programID); + } + } + + public function getTopPairs($count = '') + { + if($count == 'count') return count($this->program->getTopPairs()); + return $this->program->getTopPairs(); + } + + public function getUnfinished($programID) + { + $program = $this->program->getById($programID); + + return $this->program->hasUnfinished($program); + } + + public function getKanbanGroup($type = ''){ + $program = $this->program->getKanbanGroup(); + return $program; + } + + public function getListByStatus($status) + { + $this->program->cookie->showClosed = 'ture'; + $programs = $this->program->getList($status); + if(!$programs) return 0; + foreach($programs as $program) + { + if($program->status != $status and $status != 'all') return 0; + } + return count($programs); + } + + public function getListByOrder($orderBy) + { + $programs = $this->program->getList('all', $orderBy); + return checkOrder($programs, $orderBy); + } + + public function getListByProgramID($programID = 0) + { + return count($this->program->getProjectList($programID)); + } + + public function getListByStatusNo($browseType = 'all') + { + $projects = $this->program->getProjectList('0', $browseType); + + if(!$projects) return 0; + foreach($projects as $project) + { + if($project->status != $browseType and $browseType != 'all' and $browseType != 'undone') return 0; + if($browseType == 'undone' and ($project->status != ('wait' or 'doing'))) return 0; + } + + return count($projects); + } + + public function getListByOrderId($orderBy = 'id_desc') + { + $projects = $this->program->getProjectList('0', 'all', '0', $orderBy); + + return checkOrder($projects, $orderBy); + } + + public function getListAddProgramTitle($programTitle = 0) + { + return $this->program->getProjectList('0', 'all', '0', 'id_desc', '', $programTitle); + } + + public function getListByInvolved($involved = 0, $count = '') + { + $projects = $this->program->getProjectList('0', 'all', '0', 'id_desc', '', '0', $involved); + + if($count == 'count') return count($projects); + return $projects; + } + + public function setTreePath($programID) + { + $programPath = $this->program->setTreePath($programID); + if($programPath) + { + return $this->program->getById($programID); + } + else + { + return 0; + } + } + + public function update($programID, $data) + { + global $app; + + $_POST = $data; + $result = $this->program->update(10); + if(dao::isError()) return array('message' => dao::getError()); + + $app->dbh->query("UPDATE " . TABLE_PROGRAM . " SET name = '" . $result[0]['old']. "' where id = '" . $programID . "'"); + return $result; + } + + public function updateProgram($programID, $status = 0) + { + $data = array( + 'parent' => '0', + 'name' => '测试更新项目集十', + 'begin' => '2020-10-10', + 'end' => '2020-10-11', + 'acl' => 'private', + 'budget' => '100', + 'budgetUnit' => 'CNY', + 'whitelist' => array('dev10', 'dev12') + ); + + switch($status) + { + case '1': // 项目集名称已经存在时 + $data['name'] = '项目集1'; + break; + case '2': // 当计划开始为空时更新项目集信息 + $data['begin'] = ''; + break; + case '3': // 当计划完成为空时更新项目集信息 + $data['end'] = ''; + break; + case '4': // 当计划完成小于计划开始时 + $data['end'] = '2020-01-01'; + break; + case '5': // 项目集开始时间小于父项目集时 + $data['parent'] = '9'; + $data['begin'] = '2019-01-01'; + break; + default: // 更新id为10的项目集信息 + } + return $this->update($programID, $data); + } +} +?> diff --git a/test/class/project.class.php b/test/class/project.class.php new file mode 100644 index 0000000000..be3d90cb2c --- /dev/null +++ b/test/class/project.class.php @@ -0,0 +1,493 @@ +project = $tester->loadModel('project'); + } + + /** + * * Check project status after activate a project.▫ + * *▫ + * * @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; + } + + public function checkHasChildren($projectID) + { + return $this->project->checkHasChildren($projectID); + } + + /** + * Check project status after close a project. + * + * @param int $projectID + * @access public + * @return bool + */ + public function checkStatusOff($projectID, $closeTime = array()) + { + $checkStatus = array(); + $closeEnd = array('realEnd' => ''); + foreach($closeEnd as $filed => $defaultValue) $_POST[$filed] = $defaultValue; + foreach($closeTime as $key => $value) $_POST[$key] = $value; + + $oldProject = $this->project->getById($projectID); + if($oldProject->status == 'suspended' or $oldProject->status == 'closed') return false; + + $change = $this->project->close($projectID); + + $project = $this->project->getById($projectID); + if($project->status != 'closed') return false; + + return true; + } + + /** + * Check budget unit list. + * + * @param string $checkList▫ + * @access public + * @return bool + */ + public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元')) + { + $budgetList = $this->project->getBudgetUnitList(); + foreach($budgetList as $enBudget => $zhBudget) + { + if($checkList[$enBudget] != $zhBudget) return false; + } + return true; + } + + /** + * * Check projectList get from getByIdList. + * * + * * @param array $projectIdList + * * @param int $count + * * @access public + * * @return array + * */ + public function getByIdList($projectIdList, $count) + { + $projectList = $this->project->getByIdList($projectIdList); + if(count($projectList) != $count) return false; + return $projectList; + } + + /** + * * Get project by ID. + * * + * * @param int $projectID + * * @access public + * * @return object + * */ + public function getProjectByID($projectID) + { + return $this->project->getByID($projectID); + } + + /** + * * Get program by ID. + * * + * * @param int $programID + * * @access public + * * @return object + * */ + public function getProgramByID($programID) + { + return $this->project->getByID($programID, 'program'); + } + + /** + * * Get sprint by ID. + * * + * * @param int $sprintID + * * @access public + * * @return object + * */ + + public function getSprintByID($sprintID) + { + return $this->project->getByID($sprintID, 'sprint'); + } + + /** + * * Get stage by ID. + * * + * * @param int $stageID + * * @access public + * * @return object + * */ + public function getStageByID($stageID) + { + return $this->project->getByID($stageID, 'stage'); + } + + /** + * * Get Kanban by ID, + * * + * * @param int $kanbanID + * * @access public + * * @return void + * */ + public function getKanbanByID($kanbanID) + { + return $this->project->getByID($kanbanID, 'kanban'); + } + + /** + * * Get project by status. + * * + * * @param string $status + * * @access public + * * @return int + * */ + public function getBystatus($status) + { + $projects = $this->project->getOverviewList('byStatus', $status); + if(!$projects) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'No data.'; + + return $result; + } + + if($status == 'undone') $status = 'wait,doing,suspended'; + + foreach($projects as $project) + { + if(strpos(",$status,", $project->status) === false) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'Error data.'; + + return $result; + } + } + + return count($projects); + } + + /** + * * Get project list by order. + * * + * * @param string $orderBy + * * @access public + * * @return void + * */ + public function getListByOrder($orderBy) + { + $projects = $this->project->getOverviewList('byStatus', 'wait', $orderBy); + return checkOrder($projects, $orderBy); + } + + /** + * * Get project by ID. + * * + * * @param int $projectID + * * @access public + * * @return void + * */ + public function getByID($projectID) + { + return $this->project->getOverviewList('byID', $projectID); + } + + /** + * * Get project pairs by ID list. + * * + * * @param array $IDList + * * @access public + * * @return int + * */ + public function getByIdListFind($IDList) + { + $projects = $this->project->getPairsByIdList($IDList); + if(empty($projects)) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'No data.'; + + return $result; + } + + foreach($projects as $projectID => $projectName) + { + if(!empty($IDList) and !in_array($projectID, $IDList)) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'Error Data.'; + + return $result; + } + } + + return count($projects); + } + + /** + * * Get parentName. + * *▫ + * * @param int $projectID▫ + * * @access public + * * @return array + * */ + public function getParentName($projectID) + { + $program = $this->project->getParentName($projectID); + if(empty($program)) return false; + return $program; + } + + /** + * * Get team member pairs.▫ + * *▫ + * * @param int $projectID▫ + * * @access public + * * @return int + * */ + public function getTeamMemberPairs($projectID) + { + $members = array_filter($this->project->getTeamMemberPairs($projectID)); + if(empty($members)) return false; + return count($members); + } + + /** + * /** + * * Check members.▫ + * *▫ + * * @param array $members▫ + * * @param array $users▫ + * * @access public + * * @return bool + * */ + public function checkMembers($members, $users) + { + foreach($users as $user) + { + if(!isset($members[$user])) return false; + } + return true; + } + + /** + * Get team memberm. + *▫ + * @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); + $members = $this->project->getTeamMembers($projectID); + if(empty($members)) return false; + if(!empty($users)) $this->checkMembers($members, $users); + return count($members); + } + + /* + * Check project status after start a project. + *▫ + * @param int $projectID▫ + * @access public + * @return bool + */ + public function checkStatusBegin($projectID) + { + $oldProject = $this->project->getById($projectID); + if($oldProject->status != 'suspended' and $oldProject->status != 'wait') return false; + + $change = $this->project->start($projectID); + $project = $this->project->getById($projectID); + if($project->status != 'doing') return false; + + return true; + } + + /* + * Check project status after suspend a project. + * + * @param int $projectID▫ + * @access public + * @return bool + */ + public function checkStatusStop($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; + } + + public function getExecutionData($projectID, $type = '') + { + $table = 'zt_project'; + $executions = $this->project->getDataByProject($table, $projectID, $type); + if(empty($executions)) return false; + return $executions; + } + + /** + * * Get builds from getDataByProject. + * * + * * @param int $projectID + * * @access public + * * @return array + * */ + public function getBuildData($projectID) + { + $builds = $this->project->getDataByProject(TABLE_BUILD, $projectID); + if(empty($builds)) return false; + return $builds; + } + + /** + * * Get releases from getDataByProject. + * * + * * @param int $projectID + * * @access public + * * @return array + * */ + public function getReleaseData($projectID) + { + $releases = $this->project->getDataByProject(TABLE_RELEASE, $projectID); + if(empty($releases)) return false; + return $releases; + } + + public function getByProgram($programID) + { + $projects = $this->project->getPairsByProgram($programID); + if(empty($projects)) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'No data.'; + + return $result; + } + + return count($projects); + } + + /** + * Get project pairs by status. + * + * @param string $status + * @access public + * @return int + */ + + public function getByStatusPairs($status) + { + $projects = $this->project->getPairsByProgram(2, $status); + if(empty($projects)) + { + $result = array(); + $result['code'] = 'fail'; + $result['message'] = 'No data.'; + + return $result; + } + + return count($projects); + } + + /** + * Get project list by order. + * + * @param string $orderBy + * @access public + * @return int + */ + + public function getConsumed($projectIdList) + { + $projects = $this->project->getProjectsConsumed($projectIdList, $time = ''); + return $projects; + } + + public function getByStatusExe($status) + { + $executions = $this->project->getStats(0, $status); + if(empty($executions)) return false; + if($status != 'all') + { + foreach($executions as $execution) + { + if($execution->status != $status) return false; + } + } + return count($executions); + } + + /* + * Get executions by project. + * + * @param int $projectID + * @access public + * @return int + */ + public function getByProject($projectID) + { + $executions = $this->project->getStats($projectID, 'all'); + if(empty($executions)) return false; + foreach($executions as $execution) + { + if($execution->project != $projectID) return false; + } + return count($executions); + } + + /* + * Get executions by order. + * + * @param string $orderBy + + * @access public + * @return bool + */ + + public function getTotalBugBy($projectIdList, $status) + { + $projects = $this->project->getTotalBugByProject($projectIdList, $status); + return $projects; + } + + public function getWorkHour($projectID) + { + $projects = $this->project->getWorkhour($projectID); + } + +} +?> From aac3861c31e4b0dd90a46a0f357de4842f6f0827 Mon Sep 17 00:00:00 2001 From: "[denghongtao]" <[denghongtao@easycorp.ltd]> Date: Mon, 14 Mar 2022 09:22:53 +0800 Subject: [PATCH 6/8] * Add auto test. --- test/model/product/create.php | 72 +++++------ test/model/product/getLatestProject.php | 31 ++--- test/model/product/getList.php | 101 ++++------------ test/model/product/getPairs.php | 41 ++++--- .../model/product/getProjectListByProduct.php | 40 ++---- .../product/getProjectPairsByProduct.php | 44 +++---- test/model/product/isClickable.php | 34 ++---- test/model/product/update.php | 72 ++++------- test/model/program/create.php | 90 +++----------- test/model/program/createstakeholder.php | 28 +---- test/model/program/getbudgetleft.php | 26 +--- test/model/program/getbudgetunitlist.php | 27 +---- test/model/program/getbyid.php | 34 ++---- test/model/program/getchildren.php | 38 ++---- test/model/program/getinvolvedprograms.php | 26 ++-- test/model/program/getkanbangroup.php | 15 +-- test/model/program/getlist.php | 55 +++------ test/model/program/getpairs.php | 41 ++----- test/model/program/getpairsbylist.php | 50 +++----- test/model/program/getparentpairs.php | 33 +---- test/model/program/getparentpm.php | 23 +--- test/model/program/getproductpairs.php | 30 +++-- test/model/program/getprogresslist.php | 37 ++---- test/model/program/getprojectlist.php | 85 +++---------- test/model/program/getprojectstats.php | 85 +++---------- test/model/program/getstakeholders.php | 55 ++------- .../program/getstakeholdersbyprograms.php | 44 ++----- test/model/program/getteammemberpairs.php | 39 ++---- test/model/program/gettopbyid.php | 33 ++--- test/model/program/gettoppairs.php | 31 ++--- test/model/program/hasunfinished.php | 26 +--- test/model/program/processnode.php | 11 +- test/model/program/settreepath.php | 35 ++---- test/model/program/update.php | 72 ++--------- test/model/project/activate.php | 42 ++----- test/model/project/checkHasChildren.php | 32 ++--- test/model/project/checkHasContent.php | 9 +- test/model/project/close.php | 47 ++------ test/model/project/getBudgetUnitList.php | 34 +----- test/model/project/getByID.php | 114 ++++-------------- test/model/project/getByIdList.php | 32 +---- test/model/project/getDataByProject.php | 92 ++++---------- test/model/project/getInfoList.php | 5 +- test/model/project/getOverviewList.php | 99 +++------------ test/model/project/getPairsByIdList.php | 56 ++------- test/model/project/getPairsByProgram.php | 89 +++----------- test/model/project/getParentName.php | 37 ++---- test/model/project/getProjectsConsumed.php | 16 ++- test/model/project/getStatData.php | 4 +- test/model/project/getStats.php | 91 +++----------- test/model/project/getSwitcher.php | 8 +- test/model/project/getTeamMemberPairs.php | 36 ++---- test/model/project/getTeamMembers.php | 57 ++------- test/model/project/getTotalBugByProject.php | 12 ++ .../project/getTotalStoriesByProject.php | 4 +- test/model/project/getWorkhour.php | 8 +- test/model/project/isClickable.php | 69 ++++++----- test/model/project/saveState.php | 4 +- test/model/project/start.php | 49 ++------ test/model/project/suspend.php | 27 +++-- test/ztest | 8 ++ 61 files changed, 717 insertions(+), 1868 deletions(-) diff --git a/test/model/product/create.php b/test/model/product/create.php index 9fb1e49504..3323407f07 100755 --- a/test/model/product/create.php +++ b/test/model/product/create.php @@ -1,7 +1,9 @@ #!/usr/bin/env php create(); cid=1 pid=1 +测试正常的创建 >> case1 +测试不填产品代号的情况 >> 『code』不能为空。 +测试创建重复的产品 >> 『code』已经有『testcase1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +测试不填产品名称的情况 >> 『name』不能为空。 +测试传入name和code >> case3,testcase3 +测试传入program、name、code >> 3,case4,testcase4 +测试传入program、name、code、type、status >> 4,branch,closed +测试不填权限控制的情况 >> 『code』不能为空。 + */ -$config = new stdClass(); -$config->createFields->product = array('program' => '', 'name' => '', 'code' => '', 'PO' => '', 'QD' => '', 'RD' => '', 'type' => 'normal', 'status' => 'normal', 'desc' => '', 'acl' => 'private'); +$createtest = new Product('admin'); -function createObject($module = '', $param = array()) -{ - global $config; - foreach($config->createFields->$module as $field => $defaultValue) $_POST[$field] = $defaultValue; +$t_create = array('name' => 'case1', 'code' => 'testcase1'); +$t_noid = array('name' => 'case2'); +$t_repeat = array('name' => 'case1', 'code' => 'testcase1'); +$t_noname = array('code' => 'testcase1'); +$t_namecode = array('name' => 'case3', 'code' => 'testcase3'); +$t_pronamecode = array('program' => '3', 'name' => 'case4', 'code' => 'testcase4'); +$t_intypestatus = array('program' => '4', 'name' => 'case5', 'code' => 'testcase5', 'type' => 'branch', 'status' => 'closed'); +$t_noacl = array('name' => 'case12', 'code' => 'testcase1', 'acl' => ''); - foreach($param as $key => $value) $_POST[$key] = $value; - - global $tester; - $objectModel = $tester->loadModel($module); - $objectID = $objectModel->create(); - unset($_POST); - - if(dao::isError()) - { - return dao::getError(); - } - else - { - $object = $objectModel->getByID($objectID); - return $object; - } -} - -$create1 = array('name' => 'case1', 'code' => 'testcase1'); -$create2 = array('name' => 'case2'); -$create3 = array('name' => 'case1', 'code' => 'testcase1'); -$create4 = array('code' => 'testcase1'); -$create5 = array('name' => 'case3', 'code' => 'testcase3'); -$create6 = array('program' => '3', 'name' => 'case4', 'code' => 'testcase4'); -$create7 = array('program' => '4', 'name' => 'case5', 'code' => 'testcase5', 'type' => 'branch', 'status' => 'closed'); - -r(createObject('product', $create1)) && p('name') && e('case1'); // 测试正常的创建 -r(createObject('product', $create2)) && p('code:0') && e('『code』不能为空。'); // 测试不填产品代号的情况 -r(createObject('product', $create3)) && p('code:0') && e('『code』已经有『testcase1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试创建重复的产品 -r(createObject('product', $create4)) && p('name:0') && e('『name』不能为空。'); // 测试不填产品名称的情况 -r(createObject('product', $create5)) && p('name,code') && e('case3,testcase3'); // 测试传入name和code -r(createObject('product', $create6)) && p('program,name,code') && e('3,case4,testcase4'); // 测试传入program、name、code -r(createObject('product', $create7)) && p('program,type,status') && e('4,branch,closed'); // 测试传入program、name、code、type、status - -system("./ztest init"); +r($createtest->createObject($t_create)) && p('name') && e('case1'); // 测试正常的创建 +r($createtest->createObject($t_noid)) && p('code:0') && e('『code』不能为空。'); // 测试不填产品代号的情况 +r($createtest->createObject($t_repeat)) && p('code:0') && e('『code』已经有『testcase1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试创建重复的产品 +r($createtest->createObject($t_noname)) && p('name:0') && e('『name』不能为空。'); // 测试不填产品名称的情况 +r($createtest->createObject($t_namecode)) && p('name,code') && e('case3,testcase3'); // 测试传入name和code +r($createtest->createObject($t_pronamecode)) && p('program,name,code') && e('3,case4,testcase4'); // 测试传入program、name、code +r($createtest->createObject($t_intypestatus)) && p('program,type,status') && e('4,branch,closed'); // 测试传入program、name、code、type、status +r($createtest->createObject($t_noacl)) && p('acl:0') && e('『code』不能为空。'); // 测试不填权限控制的情况 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/product/getLatestProject.php b/test/model/product/getLatestProject.php index 01335d4f22..b11f55c77c 100755 --- a/test/model/product/getLatestProject.php +++ b/test/model/product/getLatestProject.php @@ -1,6 +1,7 @@ #!/usr/bin/env php getLatestProject(); cid=1 pid=1 +测试产品25关联的最后一个未关闭的项目,按begin字段排序 >> 315 +测试产品38关联的最后一个未关闭的项目,按begin字段排序 >> 688 +传入不存在的产品 >> 没有数据 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->product = $tester->loadModel('product'); - } - public function testGetLatestProject($productID) - { - $project = $this->product->getLatestProject($productID); - if($project == false) return '没有数据'; - return $project; - } -} +$product = new Product('admin'); -$z = new Tester('admin'); +$t_project25 = array('id'=>'25'); +$t_project38 = array('id'=>'38'); +$t_project101 = array('id'=>'101'); -r($z->testGetLatestProject(25)) && p('id') && e('315'); // 测试产品25关联的最后一个未关闭的项目,按begin字段排序 -r($z->testGetLatestProject(38)) && p('id') && e('688'); // 测试产品38关联的最后一个未关闭的项目,按begin字段排序 -r($z->testGetLatestProject(101)) && p() && e('没有数据'); // 传入不存在的产品 +r($product->testGetLatestProject($t_project25['id'])) && p('id') && e('315'); // 测试产品25关联的最后一个未关闭的项目,按begin字段排序 +r($product->testGetLatestProject($t_project38['id'])) && p('id') && e('688'); // 测试产品38关联的最后一个未关闭的项目,按begin字段排序 +r($product->testGetLatestProject($t_project101['id'])) && p() && e('没有数据'); // 传入不存在的产品 \ No newline at end of file diff --git a/test/model/product/getList.php b/test/model/product/getList.php index 1a47294f60..749896f32c 100755 --- a/test/model/product/getList.php +++ b/test/model/product/getList.php @@ -1,6 +1,7 @@ #!/usr/bin/env php getList(); cid=1 pid=1 +返回项目集1下的产品数量 >> 9 +测试传入programID=0的情况 >> 100 +传入不存在的项目集 >> 0 +返回项目集1下的未关闭的产品数量 >> 5 +获取所有的未关闭的产品数量 >> 60 +返回项目集1下的关闭了的产品数量 >> 4 +返回所有的未关闭的产品数量 >> 40 +返回项目集1下的与当前用户有关系的产品数量 >> 0 +返回项目集1下产品线1的产品数量 >> 9 +返回项目集1下产品线2的产品数量 >> 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->product = $tester->loadModel('product'); - } - public function getAllProducts($programID) - { - return $this->product->getList($programID); - } - public function getAllProductsCount($programID) - { - return count($this->getAllProducts($programID)); - } +$adminTester = new Product('admin'); - public function getNoclosedProducts($programID) - { - return $this->product->getList($programID, 'noclosed'); - } - public function getNoclosedProductsCount($programID) - { - return count($this->getNoclosedProducts($programID)); - } +$t_numproject = array('0','1', '2', '11'); - public function getClosedProducts($programID) - { - return $this->product->getList($programID, 'closed'); - } - public function getClosedProductsCount($programID) - { - return count($this->getClosedProducts($programID)); - } - - public function getInvolvedProducts($programID) - { - return $this->product->getList($programID, 'involved'); - } - public function getInvolvedProductsCount($programID) - { - return count($this->getInvolvedProducts($programID)); - } - - public function getProductsByLine($programID, $line = 0) - { - return $this->product->getList($programID, 'all', 0, $line); - } - public function countProductsByLine($programID, $line = 0) - { - return count($this->getProductsByLine($programID, $line)); - } - - public function getProductList($programID, $status = 'all', $line = 0) - { - return $this->product->getList($programID, $status, 0, $line); - } - public function getProductCount($programID, $status = 'all', $line = 0) - { - return count($this->getProductList($programID, $status, $line)); - } -} - -$adminTester = new Tester('admin'); - -r($adminTester->getAllProductsCount(1)) && p() && e('9'); // 返回项目集1下的产品数量 -r($adminTester->getAllProductsCount(0)) && p() && e('100'); // 测试传入programID=0的情况 -r($adminTester->getAllProductsCount(11)) && p() && e('0'); // 传入不存在的项目集 - -r($adminTester->getNoclosedProductsCount(1)) && p() && e('5'); // 返回项目集1下的未关闭的产品数量 -r($adminTester->getNoclosedProductsCount(0)) && p() && e('60'); // 获取所有的未关闭的产品数量 - -r($adminTester->getClosedProductsCount(1)) && p() && e('4'); // 返回项目集1下的关闭了的产品数量 -r($adminTester->getClosedProductsCount(0)) && p() && e('40'); // 返回所有的未关闭的产品数量 - -r($adminTester->getInvolvedProductsCount(1)) && p() && e('0'); // 返回项目集1下的与当前用户有关系的产品数量 - -r($adminTester->countProductsByLine(1, 1)) && p() && e('9'); // 返回项目集1下产品线1的产品数量 -r($adminTester->countProductsByLine(1, 2)) && p() && e('0'); // 返回项目集1下产品线2的产品数量 +r($adminTester->getAllProductsCount($t_numproject[1])) && p() && e('9'); // 返回项目集1下的产品数量 +r($adminTester->getAllProductsCount($t_numproject[0])) && p() && e('100'); // 测试传入programID=0的情况 +r($adminTester->getAllProductsCount($t_numproject[3])) && p() && e('0'); // 传入不存在的项目集 +r($adminTester->getNoclosedProductsCount($t_numproject[1])) && p() && e('5'); // 返回项目集1下的未关闭的产品数量 +r($adminTester->getNoclosedProductsCount($t_numproject[0])) && p() && e('60'); // 获取所有的未关闭的产品数量 +r($adminTester->getClosedProductsCount($t_numproject[1])) && p() && e('4'); // 返回项目集1下的关闭了的产品数量 +r($adminTester->getClosedProductsCount($t_numproject[0])) && p() && e('40'); // 返回所有的未关闭的产品数量 +r($adminTester->getInvolvedProductsCount($t_numproject[1])) && p() && e('0'); // 返回项目集1下的与当前用户有关系的产品数量 +r($adminTester->countProductsByLine($t_numproject[1], $t_numproject[1])) && p() && e('9'); // 返回项目集1下产品线1的产品数量 +r($adminTester->countProductsByLine($t_numproject[1], $t_numproject[2])) && p() && e('0'); // 返回项目集1下产品线2的产品数量 \ No newline at end of file diff --git a/test/model/product/getPairs.php b/test/model/product/getPairs.php index e6709e2d08..f67fcefbba 100755 --- a/test/model/product/getPairs.php +++ b/test/model/product/getPairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php getPairs(); cid=1 pid=1 +测试项目集10下的11号产品 >> 正常产品11 +测试项目集10下的55号产品 >> 多分支产品55 +测试项目集10下的99号产品 >> 多平台产品99 +测试不存在的项目集 >> 没有数据 +返回所有产品的数量 >> 100 +返回项目集10下的所有产品 >> 9 +测试项目集10下的未关闭产品5 >> 正常产品6 +返回项目集10下的未关闭产品的数量 >> 5 + */ -class Tester +/*class Tester { public function __construct($user, $orderBy = 'id_desc') { @@ -66,21 +76,20 @@ class Tester $pairs = $this->product->getPairs($mode, $programID); return checkOrder($pairs, $orderBy); } -} +}*/ -$tester = new Tester('admin'); +$tester = new Product('admin'); -r($tester->getProductPairs(10)) && p('11') && e('正常产品11'); // 测试项目集10下的11号产品 -r($tester->getProductPairs(10)) && p('55') && e('多分支产品55'); // 测试项目集10下的55号产品 -r($tester->getProductPairs(10)) && p('99') && e('多平台产品99'); // 测试项目集10下的99号产品 -r($tester->getProductPairs(11)) && p() && e('没有数据'); // 测试不存在的项目集 +$t_peoduct10 = array('programID'=>'10'); +$t_noproduct = array('programID'=>'11'); +$t_alproduct = array('programID'=>'0'); +$t_notclose5 = array('programID'=>'5'); -r($tester->getProductPairsCount(0)) && p() && e('100'); // 返回所有产品的数量 -r($tester->getProductPairsCount(10)) && p() && e('9'); // 返回项目集10下的所有产品 - -r($tester->getNoclosedPairs(5)) && p('6') && e('正常产品6'); // 测试项目集10下的未关闭产品5 -r($tester->getNoclosedPairsCount(10)) && p() && e('5'); // 返回项目集10下的未关闭产品的数量 - -r($tester->getProductPairsByOrder(10, '', 'program_desc')) && p() && e('1'); // 测试顺序program_desc -r($tester->getProductPairsByOrder(11, '', 'program_asc')) && p() && e('1'); // 测试顺序program_asc -r($tester->getProductPairsByOrder(11, '', 'type_desc')) && p() && e('1'); // 测试顺序type_desc +r($tester->getProductPairs($t_peoduct10['programID'])) && p('11') && e('正常产品11'); // 测试项目集10下的11号产品 +r($tester->getProductPairs($t_peoduct10['programID'])) && p('55') && e('多分支产品55'); // 测试项目集10下的55号产品 +r($tester->getProductPairs($t_peoduct10['programID'])) && p('99') && e('多平台产品99'); // 测试项目集10下的99号产品 +r($tester->getProductPairs($t_noproduct['programID'])) && p() && e('没有数据'); // 测试不存在的项目集 +r($tester->getProductPairsCount($t_alproduct['programID'])) && p() && e('100'); // 返回所有产品的数量 +r($tester->getProductPairsCount($t_peoduct10['programID'])) && p() && e('9'); // 返回项目集10下的所有产品 +r($tester->getNoclosedPairs($t_notclose5['programID'])) && p('6') && e('正常产品6'); // 测试项目集10下的未关闭产品5 +r($tester->getNoclosedPairsCount($t_peoduct10['programID'])) && p() && e('5'); // 返回项目集10下的未关闭产品的数量 \ No newline at end of file diff --git a/test/model/product/getProjectListByProduct.php b/test/model/product/getProjectListByProduct.php index 56169147f6..f6bef8ec15 100755 --- a/test/model/product/getProjectListByProduct.php +++ b/test/model/product/getProjectListByProduct.php @@ -1,5 +1,7 @@ #!/usr/bin/env php -getProjectListByProduct(); cid=1 pid=1 +返回产品1关联的项目11名字 >> 项目1 +返回产品1关联的项目21名字 >> 项目11 +传入不存在的产品 >> 没有数据 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->product = $tester->loadModel('product'); - } +$tester = new Product('admin'); - public function getAllProjectsByProduct($productID) - { - $projects = $this->product->getProjectListByProduct($productID, 'all'); - if($projects == array()) return '没有数据'; - return $projects; - } +$t_retion = array('1', '1', '101'); - public function getProjectsByStatus($productID, $status) - { - $projects = $this->product->getProjectListByProduct($productID, $browseType); - if($projects == array()) return '没有数据'; - return $projects; - } -} - -$tester = new Tester('admin'); -r($tester->getAllProjectsByProduct(1)) && p('21:name') && e('项目11'); // 返回产品1关联的项目11名字 -r($tester->getAllProjectsByProduct(1)) && p('11:name') && e('项目1'); // 返回产品1关联的项目21名字 -r($tester->getAllProjectsByProduct(101)) && p() && e('没有数据'); // 传入不存在的产品 +//var_dump($tester->getAllProjectsByProduct($t_retion[0]));die; +r($tester->getAllProjectsByProduct($t_retion[0])) && p('11:name') && e('项目1'); // 返回产品1关联的项目11名字 +r($tester->getAllProjectsByProduct($t_retion[1])) && p('21:name') && e('项目11'); // 返回产品1关联的项目21名字 +r($tester->getAllProjectsByProduct($t_retion[2])) && p() && e('没有数据'); // 传入不存在的产品 \ No newline at end of file diff --git a/test/model/product/getProjectPairsByProduct.php b/test/model/product/getProjectPairsByProduct.php index c471c5327f..ec3f5a1ada 100755 --- a/test/model/product/getProjectPairsByProduct.php +++ b/test/model/product/getProjectPairsByProduct.php @@ -1,6 +1,7 @@ #!/usr/bin/env php getProjectPairsByProduct(); cid=1 pid=1 +返回产品1关联的项目11名字 >> 项目1 +返回产品1关联的项目21名字 >> 项目11 +传入不存在的产品 >> 没有数据 +返回id为15的项目名 >> 项目5 +传入不存在的项目id >> 没有数据 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->product = $tester->loadModel('product'); - } +$tester = new Product('admin'); - public function getProjectPairsByProductID($productID) - { - $projects = $this->product->getProjectPairsByProduct($productID, 0, 0); - if($projects == array()) return '没有数据'; - return $projects; - } +$t_return = array('1', '101', '15', '701'); - public function getAppendProject($projectID) - { - $project = $this->product->getProjectPairsByProduct(10086, 0, $projectID); - if($project == array()) return '没有数据'; - return $project; - } -} - -$tester = new Tester('admin'); - -r($tester->getProjectPairsByProductID(1)) && p('11') && e('项目1'); // 返回产品1关联的项目11名字 -r($tester->getProjectPairsByProductID(1)) && p('21') && e('项目11'); // 返回产品1关联的项目21名字 -r($tester->getProjectPairsByProductID(101)) && p() && e('没有数据'); // 传入不存在的产品 - -r($tester->getAppendProject(15)) && p('15') && e('项目5'); // 返回id为15的项目名 -r($tester->getAppendProject(701)) && p() && e('没有数据'); // 传入不存在的项目id +r($tester->getProjectPairsByProductID($t_return[0])) && p('11') && e('项目1'); // 返回产品1关联的项目11名字 +r($tester->getProjectPairsByProductID($t_return[0])) && p('21') && e('项目11'); // 返回产品1关联的项目21名字 +r($tester->getProjectPairsByProductID($t_return[1])) && p() && e('没有数据'); // 传入不存在的产品 +r($tester->getAppendProject($t_return[2])) && p('15') && e('项目5'); // 返回id为15的项目名 +r($tester->getAppendProject($t_return[3])) && p() && e('没有数据'); // 传入不存在的项目id \ No newline at end of file diff --git a/test/model/product/isClickable.php b/test/model/product/isClickable.php index 751bc25aa0..fc046148e0 100755 --- a/test/model/product/isClickable.php +++ b/test/model/product/isClickable.php @@ -1,6 +1,8 @@ #!/usr/bin/env php isClickable(); cid=1 pid=1 +status为normal,action为close >> true +status为close,action为close >> false +status为normal,action为start >> true +status为close,action为start >> true + */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->product = $tester->loadModel('product'); - } +$adminTester = new Product('admin'); - public function testIsClickable($productID, $status) - { - $product = $this->product->getById($productID); - $isClick = $this->product->isClickable($product, $status); - return $isClick == false ? 'false' : 'true'; - } -} +$t_status = array('2', '75', 'close', 'start'); -$adminTester = new Tester('admin'); - -r($adminTester->testIsClickable(2, 'close')) && p() && e('true'); // status为normal,action为close -r($adminTester->testIsClickable(75, 'close')) && p() && e('false'); // status为close,action为close -r($adminTester->testIsClickable(2, 'start')) && p() && e('true'); // status为normal,action为start -r($adminTester->testIsClickable(75, 'start')) && p() && e('true'); // status为close,action为start +r($adminTester->testIsClickable($t_status[0], $t_status[2])) && p() && e('true'); // status为normal,action为close +r($adminTester->testIsClickable($t_status[1], $t_status[2])) && p() && e('false'); // status为close,action为close +r($adminTester->testIsClickable($t_status[0], $t_status[3])) && p() && e('true'); // status为normal,action为start +r($adminTester->testIsClickable($t_status[1], $t_status[3])) && p() && e('true'); // status为close,action为start \ No newline at end of file diff --git a/test/model/product/update.php b/test/model/product/update.php index 1e3d078aa3..7835a83ac9 100755 --- a/test/model/product/update.php +++ b/test/model/product/update.php @@ -1,6 +1,7 @@ #!/usr/bin/env php update(); cid=1 pid=1 +测试更新产品名称 >> name,正常产品2,john +测试更新产品代号 >> code,code2,newcode1 +测试更新产品名称和代号 >> name,john,jack;code,newcode1,newcode2 +测试不更改产品名称 >> 没有数据更新 +测试不更改产品代号 >> 没有数据更新 +测试同一项目集下产品名称不能重复 >> 『产品名称』已经有『jack』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +测试同一项目集下产品代号不能重复 >> 『产品代号』已经有『newcode2』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 + */ -function updateObject($module, $objectID, $param = array()) -{ - global $tester; - $objectModel = $tester->loadModel($module); +$tname = new Product('admin'); - $object = $objectModel->getById($objectID); - foreach($object as $field => $value) - { - if(in_array($field, array_keys($param))) - { - $_POST[$field] = $param[$field]; - } - else - { - $_POST[$field] = $value; - } - } +$t_upname = array('name' => 'john'); +$t_upid = array('code' => 'newcode1'); +$t_idname = array('name' => 'jack', 'code' => 'newcode2'); +$t_unname = array('name' => 'jack'); +$t_unid = array('code' => 'newcode2'); +$t_repeatname = array('name' => 'jack'); +$t_repeatid = array('code' => 'newcode2'); - $change = $objectModel->update($objectID); - if($change == array()) $change = '没有数据更新'; - unset($_POST); - - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $change; - } -} - -$case1 = array('name' => 'john'); -$case2 = array('code' => 'newcode1'); -$case3 = array('name' => 'jack', 'code' => 'newcode2'); -$case4 = array('name' => 'jack'); -$case5 = array('code' => 'newcode2'); -$case6 = array('name' => 'jack'); -$case7 = array('code' => 'newcode2'); - -r(updateObject('product', 2, $case1)) && p('0:field,old,new') && e('name,正常产品2,john'); // 测试更新产品名称 -r(updateObject('product', 2, $case2)) && p('0:field,old,new') && e('code,code2,newcode1'); // 测试更新产品代号 -r(updateObject('product', 2, $case3)) && p('0:field,old,new;1:field,old,new') && e('name,john,jack;code,newcode1,newcode2'); // 测试更新产品名称和代号 -r(updateObject('product', 2, $case4)) && p() && e('没有数据更新'); // 测试不更改产品名称 -r(updateObject('product', 2, $case5)) && p() && e('没有数据更新'); // 测试不更改产品代号 -r(updateObject('product', 13, $case6)) && p('name:0') && e('『产品名称』已经有『jack』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试同一项目集下产品名称不能重复 -r(updateObject('product', 13, $case7)) && p('code:0') && e('『产品代号』已经有『newcode2』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试同一项目集下产品代号不能重复 - -system("./ztest init"); +r($tname->updateObject('product', 2, $t_upname)) && p('0:field,old,new') && e('name,正常产品2,john'); // 测试更新产品名称 +r($tname->updateObject('product', 2, $t_upid)) && p('0:field,old,new') && e('code,code2,newcode1'); // 测试更新产品代号 +r($tname->updateObject('product', 2, $t_idname)) && p('0:field,old,new;1:field,old,new') && e('name,john,jack;code,newcode1,newcode2'); // 测试更新产品名称和代号 +r($tname->updateObject('product', 2, $t_unname)) && p() && e('没有数据更新'); // 测试不更改产品名称 +r($tname->updateObject('product', 2, $t_unid)) && p() && e('没有数据更新'); // 测试不更改产品代号 +r($tname->updateObject('product', 13, $t_repeatname)) && p('name:0') && e('『产品名称』已经有『jack』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试同一项目集下产品名称不能重复 +r($tname->updateObject('product', 13, $t_repeatid)) && p('code:0') && e('『产品代号』已经有『newcode2』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 测试同一项目集下产品代号不能重复 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/program/create.php b/test/model/program/create.php index 464e5121a3..276b764ac0 100755 --- a/test/model/program/create.php +++ b/test/model/program/create.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 测试新增项目集一 +项目集名称为空时 >> 『项目集名称』不能为空。 +项目集的开始时间为空 >> 『计划开始』不能为空。 +项目集的完成时间为空 >> 『计划完成』不能为空。 +项目集的计划完成时间大于计划开始时间 >> 『计划完成』应当大于『2022-01-12』。 +项目集的完成日期大于父项目集的完成日期 >> 父项目集的开始日期:2022-01-11,开始日期不能小于父项目集的开始日期 -class Tester -{ - public function __construct($user) - { - global $tester; +*/ - su($user); - $this->program = $tester->loadModel('program'); - } - - function create($data) - { - global $app; - - $_POST = ''; - $_POST = $data; +$program = new Program('admin'); - $programID = $this->program->create(); +$add_itemset = array('1', '2', '3', '4', '5', '6'); - if(dao::isError()) return array('message' => dao::getError()); - - $program = $this->program->getById($programID); - - $app->dbh->query("DELETE FROM ". TABLE_PROGRAM ." where name = '" . $data['name']. "'"); - return $program; - } - - function createData($status) - { - $data = array( - 'parent' => 0, - 'name' => '测试新增项目集一', - 'budget' => '', - 'budgetUnit' => 'CNY', - 'begin' => '2022-01-12', - 'end' => '2022-02-12', - 'desc' => '测试项目集描述', - 'acl' => 'private' - ); - - switch($status) - { - case '1': // 创建新项目集 - break; - case '2': // 项目集名称为空时 - $data['name'] = ''; - break; - case '3': // 项目集的开始时间为空 - $data['begin'] = ''; - break; - case '4': // 项目集的完成时间为空 - $data['end'] = ''; - break; - case '5': // 项目集的计划完成时间大于计划开始时间 - $data['end'] = '2022-01-10'; - break; - case '6': // 项目集的完成日期大于父项目集的完成日期 - $data['parent'] = '1'; - $data['begin'] = '2018-01-01'; - $data['end'] = '2022-02-10'; - break; - default: - } - return $this->create($data); - } -} - -$t = new Tester('admin'); - -r($t->createData(1)) && p('name') && e('测试新增项目集一'); // 创建新项目集 -r($t->createData(2)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 项目集名称为空时 -r($t->createData(3)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 项目集的开始时间为空 -r($t->createData(4)) && p('message[end]:0') && e('『计划完成』不能为空。'); // 项目集的完成时间为空 -r($t->createData(5)) && p('message[end]:0') && e('『计划完成』应当大于『2022-01-12』。'); // 项目集的计划完成时间大于计划开始时间 -r($t->createData(6)) && p('message:begin;message:end') && e('父项目集的开始日期:2019-01-01,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2019-01-01,完成日期不能大于父项目集的完成日期'); // 项目集的完成日期大于父项目集的完成日期 +var_dump($program->createData($add_itemset[5]));die; +r($program->createData($add_itemset[0])) && p('name') && e('测试新增项目集一'); // 创建新项目集 +r($program->createData($add_itemset[1])) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 项目集名称为空时 +r($program->createData($add_itemset[2])) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 项目集的开始时间为空 +r($program->createData($add_itemset[3])) && p('message[end]:0') && e('『计划完成』不能为空。'); // 项目集的完成时间为空 +r($program->createData($add_itemset[4])) && p('message[end]:0') && e('『计划完成』应当大于『2022-01-12』。'); // 项目集的计划完成时间大于计划开始时间 +r($program->createData($add_itemset[5])) && p('message:begin;message:end') && e('父项目集的开始日期:2022-01-11,开始日期不能小于父项目集的开始日期'); // 项目集的完成日期大于父项目集的完成日期 \ No newline at end of file diff --git a/test/model/program/createstakeholder.php b/test/model/program/createstakeholder.php index 6cc646b140..f080870598 100755 --- a/test/model/program/createstakeholder.php +++ b/test/model/program/createstakeholder.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > dev2;dev1 + */ +$Stakeholder = new Program('admin'); -class Tester -{ - public function __construct($user) - { - global $tester; +$t_Stakeholder = array('1'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function createStakeholder($programID) - { - $_POST['accounts'] = array('dev1', 'dev2'); - $stakeHolder = $this->program->createStakeholder($programID); - - return $this->program->getStakeholdersByPrograms($programID); - } -} - -$t = new Tester('admin'); - -/*CreateStakeholder($programID). */ -r($t->createStakeholder(1)) && p('0:account;1:account') && e('dev2;dev1'); // 创建id=1的项目集的干系人dev1,dev2并查看。 +r($Stakeholder->createStakeholder($t_Stakeholder[0])) && p('0:account;1:account') && e('dev2;dev1'); // 创建id=1的项目集的干系人dev1,dev2并查看。 \ No newline at end of file diff --git a/test/model/program/getbudgetleft.php b/test/model/program/getbudgetleft.php index 6caa9be510..74aa772645 100755 --- a/test/model/program/getbudgetleft.php +++ b/test/model/program/getbudgetleft.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$parentProjectSet = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$t_itemsid = array('1'); - public function getBudgetLeft($programID) - { - $program = $this->program->getById(1); - - return $this->program->getBudgetLeft($program); - } -} - -$t = new Tester('admin'); - -/* GetBudgetLeft($program). */ -r($t->getBudgetLeft(1)) && p() && e('0'); // 查看父项目集id=1的预算剩余 +r($parentProjectSet->getBudgetLeft($t_itemsid[0])) && p() && e('0'); // 查看父项目集id=1的预算剩余 \ No newline at end of file diff --git a/test/model/program/getbudgetunitlist.php b/test/model/program/getbudgetunitlist.php index dd00d3ce3e..e7f28c8074 100755 --- a/test/model/program/getbudgetunitlist.php +++ b/test/model/program/getbudgetunitlist.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 人民币;美元 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getBudgetUnitList() - { - global $app; - $app->loadConfig('project'); - $app->loadLang('project'); - - return $this->program->getBudgetUnitList(); - } -} - -$t = new Tester('admin'); +$CurrencyType = new Program('admin'); /* GetBudgetUnitList(). */ -r($t->getBudgetUnitList()) && p('CNY;USD') && e('人民币;美元'); //获取货币类型列表 +r($CurrencyType->getBudgetUnitList()) && p('CNY;USD') && e('人民币;美元'); //获取货币类型列表 \ No newline at end of file diff --git a/test/model/program/getbyid.php b/test/model/program/getbyid.php index 5874e4a602..88506ecbde 100755 --- a/test/model/program/getbyid.php +++ b/test/model/program/getbyid.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 项目集1 +通过id字段获取id=1000的项目集并验证它的name。 >> Not Found + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$getIdName = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$t_verification = array('1', '1000'); - public function getById($programID) - { - if(empty($this->program->getById($programID))) - { - return array('code' => 'fail', 'message' => 'Not Found'); - } - else - { - return $this->program->getById($programID); - } - } -} - -$t = new Tester('admin'); - -/* GetById($programID). */ -r($t->getById(1)) && p('name') && e('项目集1'); // 通过id字段获取id=1的项目集并验证它的name。 -r($t->getById(1000)) && p('message') && e('Not Found'); // 通过id字段获取id=1000的项目集并验证它的name。 +r($getIdName->getById($t_verification[0])) && p('name') && e('项目集1'); // 通过id字段获取id=1的项目集并验证它的name。 +r($getIdName->getById($t_verification[1])) && p('message') && e('Not Found'); // 通过id字段获取id=1000的项目集并验证它的name。 \ No newline at end of file diff --git a/test/model/program/getchildren.php b/test/model/program/getchildren.php index 55f4304c88..96326969c1 100755 --- a/test/model/program/getchildren.php +++ b/test/model/program/getchildren.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 9 +通过id查找id=22的子项目集个数 >> 7 +通过id查找id=221的子项目集个数 >> Not Found + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$SubprojectSet = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$t_findnu = array('1', '22', '221'); - public function getChildren($programID) - { - $programInfo = $this->program->getChildren($programID); - if(empty($programInfo)) - { - return array('code' => 'fail' , 'message' => 'Not Found'); - } - else - { - return $programInfo; - } - } -} - -$t = new Tester('admin'); - -/* GetChildren($programID). */ -r($t->getChildren(1)) && p() && e('9'); // 通过id查找id=1的子项目集个数 -r($t->getChildren(220)) && p() && e('5'); // 通过id查找id=220的子项目集个数 -r($t->getChildren(221)) && p('message') && e('Not Found'); // 通过id查找id=221的子项目集个数 +r($SubprojectSet->getChildren($t_findnu[0])) && p() && e('9'); // 通过id查找id=1的子项目集个数 +r($SubprojectSet->getChildren($t_findnu[1])) && p() && e('7'); // 通过id查找id=22的子项目集个数 +r($SubprojectSet->getChildren($t_findnu[2])) && p('message') && e('Not Found'); // 通过id查找id=221的子项目集个数 \ No newline at end of file diff --git a/test/model/program/getinvolvedprograms.php b/test/model/program/getinvolvedprograms.php index 25d832de79..9af913d1b7 100755 --- a/test/model/program/getinvolvedprograms.php +++ b/test/model/program/getinvolvedprograms.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 131 +查看用户test2可以看到的项目和执行id列表 >> 1 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$listOfId = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getInvolvedPrograms($account) - { - return $this->program->getInvolvedPrograms($account); - } -} - -$t = new Tester('admin'); +$t_sulist = array('admin', 'test2'); /* GetInvolvedPrograms($account). */ -r($t->getInvolvedPrograms('admin')) && p('122') && e('122'); // 查看用户admin可以看到的项目和执行id列表 -r($t->getInvolvedPrograms('test2')) && p('1;122') && e('1;122'); // 查看用户test2可以看到的项目和执行id列表 +r($listOfId->getInvolvedPrograms($t_sulist[0])) && p('131') && e('131'); // 查看用户admin可以看到的项目和执行id列表 +r($listOfId->getInvolvedPrograms($t_sulist[1])) && p('1') && e('1'); // 查看用户test2可以看到的项目和执行id列表 \ No newline at end of file diff --git a/test/model/program/getkanbangroup.php b/test/model/program/getkanbangroup.php index 5a78d61273..0078c871fb 100755 --- a/test/model/program/getkanbangroup.php +++ b/test/model/program/getkanbangroup.php @@ -1,8 +1,7 @@ #!/usr/bin/env php > 项目集1 + */ -$program = $tester->loadModel('program'); +$t_getKanban = array('admin', 'my', 'others'); -$result = 'Not Found'; -r($program->getKanbanGroup()) && p() && e(''); -if(empty($program->getKanbanGroup()['my'])) r($result) && p() && e($result); // 获取我的看板组 -if(empty($program->getKanbanGroup()['other'])) r($result) && p() && e($result); // 获取其他看板组 +$program = new Program($t_getKanban[0]); + +r($program->getKanbanGroup()[$t_getKanban[1]]) && p('0:name') && e(''); //查看当前用户看板的所属项目 +r($program->getKanbanGroup()[$t_getKanban[2]]) && p('0:name') && e('项目集1'); //查看当前用户看板的其它项目 \ No newline at end of file diff --git a/test/model/program/getlist.php b/test/model/program/getlist.php index 34c1fb9e82..8ff948f9eb 100755 --- a/test/model/program/getlist.php +++ b/test/model/program/getlist.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 100 +查看所有'wait'的项目和项目集的个数 >> 34 +查看所有'doing'的项目和项目集的个数 >> 44 +查看所有'suspended'的项目和项目集的个数 >> 11 +查看所有'closed'的项目和项目集的个数 >> 11 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$program = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$t_checkout = array('all', 'wait', 'doing', 'suspended', 'closed', 'name_desc', 'id_asc'); - public function getListByStatus($status) - { - $this->program->cookie->showClosed = ture; - $programs = $this->program->getList($status); - if(!$programs) return 0; - foreach($programs as $program) - { - if($program->status != $status and $status != 'all') return 0; - } - return count($programs); - } - - public function getListByOrder($orderBy) - { - $programs = $this->program->getList('all', $orderBy); - return checkOrder($programs, $orderBy); - } -} - -$t = new Tester('admin'); - -/* GetList($status). */ -r($t->getListByStatus('all')) && p() && e('100'); // 查看所有项目和项目集的个数 -r($t->getListByStatus('wait')) && p() && e('34'); // 查看所有'wait'的项目和项目集的个数 -r($t->getListByStatus('doing')) && p() && e('44'); // 查看所有'doing'的项目和项目集的个数 -r($t->getListByStatus('suspended')) && p() && e('11'); // 查看所有'suspended'的项目和项目集的个数 -r($t->getListByStatus('closed')) && p() && e('11'); // 查看所有'closed'的项目和项目集的个数 - -/* GetList('all', $orderBy). */ -r($t->getListByOrder('name_desc')) && p() && e(1); // 按照项目和项目集名称倒序获取项目列表 -r($t->getListByOrder('id_asc')) && p() && e(1); // 按照ID正序获取项目和项目集列表 +r($program->getListByStatus($t_checkout[0])) && p() && e('100'); // 查看所有项目和项目集的个数 +r($program->getListByStatus($t_checkout[1])) && p() && e('34'); // 查看所有'wait'的项目和项目集的个数 +r($program->getListByStatus($t_checkout[2])) && p() && e('44'); // 查看所有'doing'的项目和项目集的个数 +r($program->getListByStatus($t_checkout[3])) && p() && e('11'); // 查看所有'suspended'的项目和项目集的个数 +r($program->getListByStatus($t_checkout[4])) && p() && e('11'); // 查看所有'closed'的项目和项目集的个数 +r($program->getListByOrder($t_checkout[5])) && p() && e(1); // 按照项目和项目集名称倒序获取项目列表 +r($program->getListByOrder($t_checkout[6])) && p() && e(1); // 按照ID正序获取项目和项目集列表 \ No newline at end of file diff --git a/test/model/program/getpairs.php b/test/model/program/getpairs.php index 51c4597448..dc08c29609 100755 --- a/test/model/program/getpairs.php +++ b/test/model/program/getpairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 10 +获取项目集id/name 的关联数组 >> 项目集1 +获取项目集id/name 的关联数组 >> 项目集9 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$noItemsets = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getPairs() - { - $programs = $this->program->getPairs(); - if(!$programs) return 0; - return $programs; - } - - public function getCount() - { - return count($this->program->getPairs()); - } -} - -$t = new Tester('admin'); - -/* Count().*/ -r($t->getCount()) && p() && e('10'); // 获取项目集个数 - -/* GetPairs().*/ -r($t->getPairs()) && p('1') && e('项目集1'); // 获取项目集id/name 的关联数组 -r($t->getPairs()) && p('9') && e('项目集9'); // 获取项目集id/name 的关联数组 -r($t->getPairs()) && p('11') && e(''); // 获取不存在的项目集id/name 的关联数组 +r($noItemsets->getCount()) && p() && e('10'); // 获取项目集个数 +r($noItemsets->getPairs()) && p('1') && e('项目集1'); // 获取项目集id/name 的关联数组 +r($noItemsets->getPairs()) && p('9') && e('项目集9'); // 获取项目集id/name 的关联数组 +r($noItemsets->getPairs()) && p('11') && e(''); // 获取不存在的项目集id/name 的关联数组 \ No newline at end of file diff --git a/test/model/program/getpairsbylist.php b/test/model/program/getpairsbylist.php index af89d17827..c789c317d7 100755 --- a/test/model/program/getpairsbylist.php +++ b/test/model/program/getpairsbylist.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 项目集1 +通过字符串'1,2,3'获取项目集名称 >> 项目集1,项目集2,项目集3 +通过数组array(1)获取项目集名称 >> 项目集1 +通过数组array(1,2,3)获取项目集名称 >> 项目集1,项目集2,项目集3 +通过id为空获取项目集名称 >> Not Found +通过id=0获取项目集名称 >> Not Found +通过id=11获取项目集名称 >> Not Found + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$itemsetsName = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getPairsByList($programIDList = '') - { - if(empty($this->program->getPairsByList($programIDList))) - { - return array('code' => 'fail', 'message' => 'Not Found'); - } - else - { - return $this->program->getPairsByList($programIDList); - } - } -} - -$t = new Tester('admin'); - -/* GetPairsByList($programIDList). */ -r($t->getPairsByList('1')) && p('1') && e('项目集1'); // 通过字符串'1'获取项目集名称 -r($t->getPairsByList('1,2,3')) && p('1,2,3') && e('项目集1,项目集2,项目集3'); // 通过字符串'1,2,3'获取项目集名称 -r($t->getPairsByList(array(1))) && p('1') && e('项目集1');//通过数组array(1)获取项目集名称 -r($t->getPairsByList(array(1,2,3))) && p('1,2,3') && e('项目集1,项目集2,项目集3');//通过数组array(1,2,3)获取项目集名称 -r($t->getPairsByList()) && p('message') && e('Not Found');// 通过id为空获取项目集名称 -r($t->getPairsByList('0')) && p('message') && e('Not Found');// 通过id=0获取项目集名称 -r($t->getPairsByList('11')) && p('message') && e('Not Found');// 通过id=11获取项目集名称 +$t_getProName = array('1', '1,2,3', array(1), array(1,2,3), '', '0', '11'); +r($itemsetsName->getPairsByList($t_getProName[0])) && p('1') && e('项目集1'); // 通过字符串'1'获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[1])) && p('1,2,3') && e('项目集1,项目集2,项目集3'); // 通过字符串'1,2,3'获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[2])) && p('1') && e('项目集1'); //通过数组array(1)获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[3])) && p('1,2,3') && e('项目集1,项目集2,项目集3'); //通过数组array(1,2,3)获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[4])) && p('message') && e('Not Found'); // 通过id为空获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[5])) && p('message') && e('Not Found'); // 通过id=0获取项目集名称 +r($itemsetsName->getPairsByList($t_getProName[6])) && p('message') && e('Not Found'); // 通过id=11获取项目集名称 \ No newline at end of file diff --git a/test/model/program/getparentpairs.php b/test/model/program/getparentpairs.php index 844a108d82..8a2149b575 100755 --- a/test/model/program/getparentpairs.php +++ b/test/model/program/getparentpairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 11 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$ParentProjectSet = new Program('admin'); - su(%$user); - $this->program = $tester->loadModel('program'); - } - - public function getParentPairs() - { - return $this->program->getParentPairs(); - } - - public function getCount() - { - return count($this->program->getParentPairs()); - } -} - -$t = new Tester('admin'); - -/* Count(). */ -r($t->getCount()) && p() && e('11'); // - -/* GetParentPairs(). */ -r($t->getParentPairs()) && p('1') && e(''); // 获取父项目集的id/name关联数组 +r($ParentProjectSet->getCount1()) && p() && e('11'); // +r($ParentProjectSet->getParentPairs()) && p('1') && e(''); // 获取父项目集的id/name关联数组 \ No newline at end of file diff --git a/test/model/program/getparentpm.php b/test/model/program/getparentpm.php index ddc957b813..0150d8a870 100755 --- a/test/model/program/getparentpm.php +++ b/test/model/program/getparentpm.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getParentPM($programIdList) - { - return $this->program->getParentPM($programIdList); - } -} - -$t = new Tester('admin'); +$getPM = new Program('admin'); /* GetParentPM($programIdList). */ -r($t->getParentPM('1')) && p() && e('0'); // +r($getPM->getParentPM('1')) && p() && e('0'); // \ No newline at end of file diff --git a/test/model/program/getproductpairs.php b/test/model/program/getproductpairs.php index 6d0a65ff0c..9f9e3708fc 100755 --- a/test/model/program/getproductpairs.php +++ b/test/model/program/getproductpairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 已关闭的正常产品23 +获取不存在的项目或项目集 >> Not Found +根据项目或项目集指派情况获取关联产品详情 >> 正常产品1 +根据项目或项目集状态获取关联产品详情 >> 多平台产品100 +查看ID=1,有指派,所有状态的关联产品数量 >> 10 +查看ID=1,有指派,未关闭的关联产品数量 >> 6 +*/ +/* class Tester { public function __construct($user) - { + { global $tester; su($user); $this->program = $tester->loadModel('program'); - } + } public function getProductPairsByID($programID = 0) { @@ -42,19 +50,19 @@ class Tester return count($this->program->getProductPairs($programID, $mode, $status)); } } - -$t = new Tester('admin'); +*/ +$getItemsets = new Program('admin'); /* GetProductPairs($programID). */ -r($t->getProductPairsByID('1')) && p('23') && e('已关闭的正常产品23'); //根据项目或项目集ID获取关联产品详情 -r($t->getProductPairsByID('1000')) && p('message') && e('Not Found'); //获取不存在的项目或项目集 +r($getItemsets->getProductPairsByID('1')) && p('23') && e('已关闭的正常产品23'); //根据项目或项目集ID获取关联产品详情 +r($getItemsets->getProductPairsByID('1000')) && p('message') && e('Not Found'); //获取不存在的项目或项目集 /* GetProductPairs('all', $mode, 'noclosed'). */ -r($t->getProductPairsByMod('all')) && p('1') && e('正常产品1'); // 根据项目或项目集指派情况获取关联产品详情 +r($getItemsets->getProductPairsByMod('all')) && p('1') && e('正常产品1'); // 根据项目或项目集指派情况获取关联产品详情 /* GetProductPairs('all', 'assign', $status). */ -r($t->getProductPairsByStatus('all')) && p('100') && e('多平台产品100'); //根据项目或项目集状态获取关联产品详情 +r($getItemsets->getProductPairsByStatus('all')) && p('100') && e('多平台产品100'); //根据项目或项目集状态获取关联产品详情 /* Count().*/ -r($t->getCount('1', 'assign', 'all')) && p() && e('10'); //查看ID=1,有指派,所有状态的关联产品数量 -r($t->getCount('1', 'assign', 'noclosed')) && p() && e('6'); //查看ID=1,有指派,未关闭的关联产品数量 +r($getItemsets->getCount2('1', 'assign', 'all')) && p() && e('10'); //查看ID=1,有指派,所有状态的关联产品数量 +r($getItemsets->getCount2('1', 'assign', 'noclosed')) && p() && e('6'); //查看ID=1,有指派,未关闭的关联产品数量 \ No newline at end of file diff --git a/test/model/program/getprogresslist.php b/test/model/program/getprogresslist.php index 120ca484a4..f5c591fce2 100755 --- a/test/model/program/getprogresslist.php +++ b/test/model/program/getprogresslist.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 100 +获取id=1的项目的进度 >> 0 +获取id=11的项目集的进度 >> 45 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$getItemsets = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getProgressList() - { - return $this->program->getProgressList(); - } - - public function getCount() - { - return count($this->program->getProgressList()); - } -} - -$t = new Tester('admin'); - -/* Count(). */ -r($t->getCount()) && p() && e('100'); // 获取项目和项目集的个数 - -/* GetProgressList(). */ -r($t->getProgressList()) && p('1') && e('0'); // 获取id=1的项目的进度 -r($t->getProgressList()) && p('11') && e('0'); // 获取id=11的项目集的进度 +r($getItemsets->getCount3()) && p() && e('100'); // 获取项目和项目集的个数 +r($getItemsets->getProgressList()) && p('1') && e('0'); // 获取id=1的项目的进度 +r($getItemsets->getProgressList()) && p('11') && e('45'); // 获取id=11的项目集的进度 \ No newline at end of file diff --git a/test/model/program/getprojectlist.php b/test/model/program/getprojectlist.php index deb56c6b8f..2247113605 100755 --- a/test/model/program/getprojectlist.php +++ b/test/model/program/getprojectlist.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 90 +查看当前项目集下所有状态为进行中的项目的个数 >> 44 +根据name倒序查看所有项目 >> 1 +根据id倒序查看所有项目的个数 >> 1 +查看所有项目(包含所属项目集名称) >> 项目1 +查看当前用户参与的项目 >> 项目1 +查看当前用户参与的项目的个数 >> 1 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->program = $tester->loadModel('program'); - $this->config->systemMode = 'new'; - } +$countProjects = new Program('admin'); - public function getListByProgramID($programID = 0) - { - return count($this->program->getProjectList($programID)); - } +$t_proNumber = array(0, 'doing', 'name_desc', 'id_desc', 0, 1, 1, 'count'); - public function getListByStatus($browseType = 'all') - { - $projects = $this->program->getProjectList('0', $browseType); - - if(!$projects) return 0; - foreach($projects as $project) - { - if($project->status != $browseType and $browseType != 'all' and $browseType != 'undone') return 0; - if($browseType == 'undone' and ($project->status != ('wait' or 'doing'))) return 0; - } - - return count($projects); - } - - public function getListByOrder($orderBy = 'id_desc') - { - $projects = $this->program->getProjectList('0', 'all', '0', $orderBy); - - return checkOrder($projects, $orderBy); - } - - public function getListAddProgramTitle($programTitle = 0) - { - return $this->program->getProjectList('0', 'all', '0', 'id_desc', '', $programTitle); - } - - public function getListByInvolved($involved = 0, $count = '') - { - $projects = $this->program->getProjectList('0', 'all', '0', 'id_desc', '', '0', $involved); - - if($count == 'count') return count($projects); - return $projects; - } -} - -$t = new Tester('admin'); - -/* GetProjectList($programID). */ -r($t->getListByProgramID(0)) && p() && e('90'); // 查看当前项目集下所有项目的个数 - -/* GetProjectList(0, $browseType). */ -r($t->getListByStatus('doing')) && p() && e('44'); // 查看当前项目集下所有状态为进行中的项目的个数 - -/* GetProjectList(0, 'all', 0, $orderBy). */ -r($t->getListByOrder('name_desc')) && p() && e('1'); // 根据name倒序查看所有项目 -r($t->getListByOrder('id_desc')) && p() && e('1'); // 根据id倒序查看所有项目的个数 - -/* GetProjectList(0, 'all', 0, 'id_desc', '', $programTitle). */ -r($t->getListAddProgramTitle(0)) && p('11:name') && e('项目1'); // 查看所有项目(包含所属项目集名称) - -/* GetProjectList(0, 'all', 0, 'id_desc', '', 0, $involved). */ -r($t->getListByInvolved(1)) && p('11:name') && e('项目1'); // 查看当前用户参与的项目 -r($t->getListByInvolved(1, 'count')) && p() && e('1'); // 查看当前用户参与的项目的个数 +r($countProjects->getListByProgramID($t_proNumber[0])) && p() && e('90'); // 查看当前项目集下所有项目的个数 +r($countProjects->getListByStatusNo($t_proNumber[1])) && p() && e('44'); // 查看当前项目集下所有状态为进行中的项目的个数 +r($countProjects->getListByOrderId($t_proNumber[2])) && p() && e('1'); // 根据name倒序查看所有项目 +r($countProjects->getListByOrderId($t_proNumber[3])) && p() && e('1'); // 根据id倒序查看所有项目的个数 +r($countProjects->getListAddProgramTitle($t_proNumber[4])) && p('11:name') && e('项目1'); // 查看所有项目(包含所属项目集名称) +r($countProjects->getListByInvolved($t_proNumber[5])) && p('11:name') && e('项目1'); // 查看当前用户参与的项目 +r($countProjects->getListByInvolved($t_proNumber[6], $t_proNumber[7])) && p() && e('1'); // 查看当前用户参与的项目的个数 \ No newline at end of file diff --git a/test/model/program/getprojectstats.php b/test/model/program/getprojectstats.php index e3f69b5ce9..cbf0f592a8 100755 --- a/test/model/program/getprojectstats.php +++ b/test/model/program/getprojectstats.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 68 +查看当前项目集下所有状态为进行中的项目的个数 >> 44 +根据name倒序查看所有项目 >> 1 +根据id倒序查看所有项目的个数 >> 1 +查看所有项目(包含所属项目集名称) >> 项目1 +查看当前用户参与的项目 >> 项目1 +查看当前用户参与的项目的个数 >> 1 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->program = $tester->loadModel('program'); - } +$program = new Program('admin'); - public function getStatsByProgramID($programID = 0) - { - return count($this->program->getProjectStats($programID)); - } - - public function getStatsByStatus($browseType = 'all') - { - $projects = $this->program->getProjectStats('0', $browseType); - - if(!$projects) return 0; - foreach($projects as $project) - { - if($project->status != $browseType and $browseType != 'all' and $browseType != 'undone') return 0; - if($browseType == 'undone' and ($project->status != ('wait' or 'doing'))) return 0; - } - - return count($projects); - } - - public function getStatsByOrder($orderBy = 'id_desc') - { - $projects = $this->program->getProjectStats('0', 'all', '0', $orderBy); - - return checkOrder($projects, $orderBy); - } - - public function getStatsAddProgramTitle($programTitle = 0) - { - return $this->program->getProjectStats('0', 'all', '0', 'id_desc', '', $programTitle); - } - - public function getStatsByInvolved($involved = 0, $count = '') - { - $projects = $this->program->getProjectStats('0', 'all', '0', 'id_desc', '', '0', $involved); - - if($count == 'count') return count($projects); - return $projects; - } -} - -$t = new Tester('admin'); - -/* GetProjectStats($programID). */ -r($t->getStatsByProgramID(0)) && p() && e('68'); // 查看当前项目集下所有未开始和进行中的项目的个数 - -/* GetProjectStats(0, $browseType). */ -r($t->getStatsByStatus('doing')) && p() && e('44'); // 查看当前项目集下所有状态为进行中的项目的个数 - -/* GetProjectStats(0, 'all', 0, $orderBy). */ -r($t->getStatsByOrder('name_desc')) && p() && e('1'); // 根据name倒序查看所有项目 -r($t->getStatsByOrder('id_desc')) && p() && e('1'); // 根据id倒序查看所有项目的个数 - -/* GetProjectStats(0, 'all', 0, 'id_desc', '', $programTitle). */ -r($t->getStatsAddProgramTitle(0)) && p('11:name') && e('项目1'); // 查看所有项目(包含所属项目集名称) - -/* GetProjectStats(0, 'all', 0, 'id_desc', '', 0, $involved). */ -r($t->getStatsByInvolved(1)) && p('11:name') && e('项目1'); // 查看当前用户参与的项目 -r($t->getStatsByInvolved(1, 'count')) && p() && e('1'); // 查看当前用户参与的项目的个数 +$t_statusNmb = array(0, 'doing', 'name_desc', 'id_desc', 0, 1 ,1, 'count'); +r($program->getStatsByProgramID($t_statusNmb[0])) && p() && e('68'); // 查看当前项目集下所有未开始和进行中的项目的个数 +r($program->getStatsByStatus($t_statusNmb[1])) && p() && e('44'); // 查看当前项目集下所有状态为进行中的项目的个数 +r($program->getStatsByOrder($t_statusNmb[2])) && p() && e('1'); // 根据name倒序查看所有项目 +r($program->getStatsByOrder($t_statusNmb[3])) && p() && e('1'); // 根据id倒序查看所有项目的个数 +r($program->getStatsAddProgramTitle($t_statusNmb[4])) && p('11:name') && e('项目1'); // 查看所有项目(包含所属项目集名称) +r($program->getStatsByInvolved($t_statusNmb[5])) && p('11:name') && e('项目1'); // 查看当前用户参与的项目 +r($program->getStatsByInvolved($t_statusNmb[6], $t_statusNmb[7])) && p() && e('1'); // 查看当前用户参与的项目的个数 \ No newline at end of file diff --git a/test/model/program/getstakeholders.php b/test/model/program/getstakeholders.php index ebbb03dc54..155abcf4dc 100755 --- a/test/model/program/getstakeholders.php +++ b/test/model/program/getstakeholders.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 0 +根据干系人id倒序排序 >> 1 +根据干系人id正序排序 >> 1 +查看项目集2的干系人个数 >> 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$program = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getByID($programID = 0) - { - $stakeholders = $this->program->getStakeholders($programID); - - return $stakeholders; - } - - public function getByOrder($orderBy = 'id_desc') - { - $stakeholders = $this->program->getStakeholders(2, $orderBy); - - return checkOrder($stakeholders, $orderBy); - } - - public function getCount($programID = 0) - { - $stakeholders = $this->program->getStakeholders($programID); - - return count($stakeholders); - } -} - -$t = new Tester('admin'); - -/* GetStakeholders($programID). */ -r($t->getByID(2)) && p() && e('0'); // 查看项目集2的干系人信息 - -/* GetStakeholders('2', $orderBy). */ -r($t->getByOrder('id_desc')) && p() && e('1'); // 根据干系人id倒序排序 -r($t->getByOrder('id_asc')) && p() && e('1'); // 根据干系人id正序排序 - -/* Count(). */ -r($t->getCount(2)) && p() && e('0'); // 查看项目集2的干系人个数 +$t_Stakeholder = array(2, 'id_desc', 'id_asc', 2); +var_dump($program->getByID1($t_Stakeholder[0]));die; +r($program->getByID1($t_Stakeholder[0])) && p() && e('0'); // 查看项目集2的干系人信息 +r($program->getByOrder($t_Stakeholder[1])) && p() && e('1'); // 根据干系人id倒序排序 +r($program->getByOrder($t_Stakeholder[2])) && p() && e('1'); // 根据干系人id正序排序 +r($program->getCount5($t_Stakeholder[3])) && p() && e('0'); // 查看项目集2的干系人个数 \ No newline at end of file diff --git a/test/model/program/getstakeholdersbyprograms.php b/test/model/program/getstakeholdersbyprograms.php index 6e54d4205d..66d073adc4 100755 --- a/test/model/program/getstakeholdersbyprograms.php +++ b/test/model/program/getstakeholdersbyprograms.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 0 +获取项目集2和项目集3的干系人名单 >> 0 +获取项目集2的干系人个数 >> 0 +获取项目集2和项目集3的干系人个数 >> 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$t = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$Stakeholder = array('2', '2,3', '2', '2,3'); - public function getByPrograms($programIdList = 0) - { - $stakeHolders = $this->program->getStakeholdersByPrograms($programIdList); - - return $stakeHolders; - } - - public function getCount($programIdList = 0) - { - $stakeHolders = $this->program->getStakeholdersByPrograms($programIdList); - - return count($stakeHolders); - } -} - -$t = new Tester('admin'); - -/* GetStakeholdersByPrograms($programIdList). */ -r($t->getByPrograms('2')) && p() && e('0'); // 获取项目集2的干系人名单 -r($t->getByPrograms('2,3')) && p() && e('0'); // 获取项目集2和项目集3的干系人名单 - -/* Count(). */ -r($t->getCount('2')) && p() && e('0'); // 获取项目集2的干系人个数 -r($t->getCount('2,3')) && p() && e('0'); // 获取项目集2和项目集3的干系人个数 +r($t->getByPrograms($Stakeholder[0])) && p() && e('0'); // 获取项目集2的干系人名单 +r($t->getByPrograms($Stakeholder[1])) && p() && e('0'); // 获取项目集2和项目集3的干系人名单 +r($t->getCount4($Stakeholder[2])) && p() && e('0'); // 获取项目集2的干系人个数 +r($t->getCount4($Stakeholder[3])) && p() && e('0'); // 获取项目集2和项目集3的干系人个数 \ No newline at end of file diff --git a/test/model/program/getteammemberpairs.php b/test/model/program/getteammemberpairs.php index 240cbc416c..d78f447259 100755 --- a/test/model/program/getteammemberpairs.php +++ b/test/model/program/getteammemberpairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > U:测试89 +获取项目集下所有团队成员 >> 181 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$program = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$t_Tnumber = array(1); - public function getById($programID) - { - if(empty($this->program->getTeamMemberPairs($programID))) - { - return array('code' => 'fail', 'message' => 'Not Found'); - } - else - { - return $this->program->getTeamMemberPairs($programID); - } - } - - public function getCount($programID) - { - return count($this->program->getTeamMemberPairs($programID)); - } -} - -$t = new Tester('admin'); - -/* GetTeamMemberPairs($programID). */ -r($t->getById(1)) && p('user89') && e('U:测试89'); //获取项目集下所有团队成员 -r($t->getCount(1)) && p() && e('181'); // 获取项目集下所有团队成员 +r($program->getById2($t_Tnumber[0])) && p('user89') && e('U:测试89'); //获取项目集下所有团队成员 +r($program->getCount6($t_Tnumber[0])) && p() && e('181'); // 获取项目集下所有团队成员 \ No newline at end of file diff --git a/test/model/program/gettopbyid.php b/test/model/program/gettopbyid.php index 37002ec599..08f1d9e43b 100755 --- a/test/model/program/gettopbyid.php +++ b/test/model/program/gettopbyid.php @@ -1,39 +1,22 @@ #!/usr/bin/env php > Not Found + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$t = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$program_id = 1; - public function getById($programID = 0) - { - if(empty($this->program->getTopById($programID))) - { - return array('code' => 'fail', 'message' => 'Not Found'); - } - else - { - return $this->program->getByTopId($programID); - } - } -} - -$t = new Tester('admin'); - -/* GetTopById($programID). */ -r($t->getByID(1)) && p('message') && e('Not Found'); // 获取项目集1最上级的项目集id +r($t->getByID3($program_id)) && p('message') && e('Not Found'); // 获取项目集1最上级的项目集id \ No newline at end of file diff --git a/test/model/program/gettoppairs.php b/test/model/program/gettoppairs.php index 461a576246..58a674e8cb 100755 --- a/test/model/program/gettoppairs.php +++ b/test/model/program/gettoppairs.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 项目集1 +查看父项目集的个数 >> 6 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$program = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } - - public function getTopPairs($count = '') - { - if($count == 'count') return count($this->program->getTopPairs()); - return $this->program->getTopPairs(); - } -} - -$t = new Tester('admin'); - -/* getTopPairs(). */ -r($t->getTopPairs()) && p('1') && e('项目集1'); // 查看id=1的父项目集 - -/* Count(). */ -r($t->getTopPairs('count')) && p() && e('10'); // 查看父项目集的个数 +$t_checkId = 'count'; +r($program->getTopPairs()) && p('1') && e('项目集1'); // 查看id=1的父项目集 +r($program->getTopPairs($t_checkId)) && p() && e('6'); // 查看父项目集的个数 \ No newline at end of file diff --git a/test/model/program/hasunfinished.php b/test/model/program/hasunfinished.php index b105043cfb..ed4953713b 100755 --- a/test/model/program/hasunfinished.php +++ b/test/model/program/hasunfinished.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 88 -class Tester -{ - public function __construct($user) - { - global $tester; +*/ - su($user); - $this->program = $tester->loadModel('program'); - } +$program = new Program('admin'); - public function getUnfinished($programID) - { - $program = $this->program->getById($programID); +$unFinish = 1; - return $this->program->hasUnfinished($program); - } -} - -$t = new Tester('admin'); - -/* HasUnfinished($program). */ -r($t->getUnfinished(1)) && p() && e('88'); // 获取项目集1下未完成的项目和项目集 +r($program->getUnfinished($unFinish)) && p() && e('88'); // 获取项目集1下未完成的项目和项目集 \ No newline at end of file diff --git a/test/model/program/processnode.php b/test/model/program/processnode.php index 88445a439e..e9fdad3e5c 100755 --- a/test/model/program/processnode.php +++ b/test/model/program/processnode.php @@ -1,6 +1,7 @@ #!/usr/bin/env php program = $tester->loadModel('program'); } -} +}*/ -$t = new Tester('admin'); +$t = new Program('admin'); $program = $tester->loadModel('program'); -r($program->processNode(1, 0, 1, 1)) && p() && e(''); // +r($program->processNode(1, 0, 1, 1)) && p() && e(''); // \ No newline at end of file diff --git a/test/model/program/settreepath.php b/test/model/program/settreepath.php index e3c58f3bc7..178acaa3da 100755 --- a/test/model/program/settreepath.php +++ b/test/model/program/settreepath.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 12, +查找不存在的id=1000的项目集的path >> 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$program = new Program('admin'); - su($user); - $this->program = $tester->loadModel('program'); - } +$findId = array(12, 1000); - public function setTreePath($programID) - { - $programPath = $this->program->setTreePath($programID); - if($programPath) - { - return $this->program->getById($programID); - } - else - { - return 0; - } - } -} - -$t = new Tester('admin'); - -/* SetTreePath($programID). */ -r($t->setTreePath(12)) && p('path') && e('12,'); // 查找id=11的项目集的path -r($t->setTreePath(1000)) && p('path') && e('0'); // 查找不存在的id=1000的项目集的path +r($program->setTreePath($findId[0])) && p('path') && e('12,'); // 查找id=11的项目集的path +#r($program->setTreePath($findId[1])) && p('path') && e('0'); // 查找不存在的id=1000的项目集的path \ No newline at end of file diff --git a/test/model/program/update.php b/test/model/program/update.php index 99486ac2a6..dfa4e67e2e 100755 --- a/test/model/program/update.php +++ b/test/model/program/update.php @@ -1,78 +1,28 @@ #!/usr/bin/env php > 测试更新项目集十 +当计划开始为空时更新项目集信息 >> 『计划开始』不能为空。 +当计划完成为空时更新项目集信息 >> 『计划完成』不能为空。 +当计划完成小于计划开始时 >> 『计划完成』应当大于『2020-10-10』。 +项目集名称已经存在时 >> 『项目集名称』已经有『项目集1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +项目集开始时间小于父项目集时 >> 父项目集的开始日期:2019-09-09,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2019-09-09,完成日期不能大于父项目集的完成日期 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->program = $tester->loadModel('program'); - } - - function update($programID, $data) - { - global $app; - - $_POST = $data; - $result = $this->program->update(10); - if(dao::isError()) return array('message' => dao::getError()); - - $app->dbh->query("UPDATE " . TABLE_PROGRAM . " SET name = '" . $result[0]['old']. "' where id = '" . $programID . "'"); - return $result; - } - - function updateProgram($programID, $status = 0) - { - $data = array( - 'parent' => '0', - 'name' => '测试更新项目集十', - 'begin' => '2020-10-10', - 'end' => '2020-10-11', - 'acl' => 'private', - 'budget' => '100', - 'budgetUnit' => 'CNY' - ); - - switch($status) - { - case '1': // 项目集名称已经存在时 - $data['name'] = '项目集1'; - break; - case '2': // 当计划开始为空时更新项目集信息 - $data['begin'] = ''; - break; - case '3': // 当计划完成为空时更新项目集信息 - $data['end'] = ''; - break; - case '4': // 当计划完成小于计划开始时 - $data['end'] = '2020-01-01'; - break; - case '5': // 项目集开始时间小于父项目集时 - $data['parent'] = '9'; - $data['begin'] = '2019-01-01'; - break; - default: // 更新id为10的项目集信息 - } - return $this->update($programID, $data); - } -} - -$t = new Tester('admin'); +$t = new Program('admin'); r($t->updateProgram(10)) && p('0:new') && e('测试更新项目集十');// 更新id为10的项目集信息 r($t->updateProgram(10, 2)) && p('message[begin]:0') && e('『计划开始』不能为空。');// 当计划开始为空时更新项目集信息 r($t->updateProgram(10, 3)) && p('message[end]:0') && e('『计划完成』不能为空。');// 当计划完成为空时更新项目集信息 r($t->updateProgram(10, 4)) && p('message[end]:0') && e('『计划完成』应当大于『2020-10-10』。');// 当计划完成小于计划开始时 r($t->updateProgram(10, 1)) && p('message[name]:0') && e('『项目集名称』已经有『项目集1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。');// 项目集名称已经存在时 -r($t->updateProgram(10, 5)) && p('message:begin;message:end') && e('父项目集的开始日期:2019-09-09,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2019-09-09,完成日期不能大于父项目集的完成日期');// 项目集开始时间小于父项目集时 +r($t->updateProgram(10, 5)) && p('message:begin;message:end') && e('父项目集的开始日期:2019-09-09,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2019-09-09,完成日期不能大于父项目集的完成日期');// 项目集开始时间小于父项目集时 \ No newline at end of file diff --git a/test/model/project/activate.php b/test/model/project/activate.php index 922f55c2dd..89b3ec20f9 100755 --- a/test/model/project/activate.php +++ b/test/model/project/activate.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 1 +开始id为67状态是closed的项目 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$beginId = array(66, 67); - /** - * Check project status after activate a project. - * - * @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的项目 +r($project->checkStatus($beginId[0])) && p() && e('1'); //开始id为66状态不是closed的项目 +r($project->checkStatus($beginId[1])) && p() && e('0'); //开始id为67状态是closed的项目 \ No newline at end of file diff --git a/test/model/project/checkHasChildren.php b/test/model/project/checkHasChildren.php index 289a947708..d4fd3638b6 100755 --- a/test/model/project/checkHasChildren.php +++ b/test/model/project/checkHasChildren.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 1 +获取id为101的项目是否有子项目 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->project = $tester->loadModel('project'); - } +$project = new Project('admin'); - /** - * Check has children project. - * - * @param int $projectID - * @access public - * @return bool - */ - public function checkHasChildren($projectID) - { - return $this->project->checkHasChildren($projectID); - } -} +$getID = array(1, 101); -$t = new Tester('admin'); - -/* CheckHasChildren($projectID). */ -r($t->checkHasChildren(1)) && p() && e('1'); //获取id为1的项目是否有子项目 -r($t->checkHasChildren(101)) && p() && e('0'); //获取id为101的项目是否有子项目 +r($project->checkHasChildren($getID[0])) && p() && e('1'); //获取id为1的项目是否有子项目 +r($project->checkHasChildren($getID[1])) && p() && e('0'); //获取id为101的项目是否有子项目 \ No newline at end of file diff --git a/test/model/project/checkHasContent.php b/test/model/project/checkHasContent.php index 29171e7460..2050494221 100755 --- a/test/model/project/checkHasContent.php +++ b/test/model/project/checkHasContent.php @@ -8,9 +8,14 @@ title=测试 projectModel::checkHasContent; cid=1 pid=1 +查找是否存在父级或者所属项目为1的数据,若存在则为true >> 1 +查找是否存在父级或者所属项目为0的数据,若存在则为ture >> 1 + */ + $project = $tester->loadModel('project'); -r($project->checkHasContent(1)) && p() && e('1'); // 查找是否存在父级或者所属项目为1的数据,若存在则为true +$unExistence = array(1, 0); -r($project->checkHasContent(0)) && p() && e('1'); // 查找是否存在父级或者所属项目为0的数据,若存在则为ture +r($project->checkHasContent($unExistence[0])) && p() && e('1'); // 查找是否存在父级或者所属项目为1的数据,若存在则为true +r($project->checkHasContent($unExistence[1])) && p() && e('1'); // 查找是否存在父级或者所属项目为0的数据,若存在则为ture \ No newline at end of file diff --git a/test/model/project/close.php b/test/model/project/close.php index 1205a383b6..9e05fbc28d 100755 --- a/test/model/project/close.php +++ b/test/model/project/close.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 1 +关闭id为26状态是closed的项目 >> 0 +关闭id为41状态是suspended的项目 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$closeId = array(20, 26, 41); +$realEnd1 = array('realEnd' => '2022-03-11'); - /** - * Check project status after close a project. - * - * @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->close($projectID); - - $project = $this->project->getById($projectID); - if($project->status != 'closed') return false; - - return true; - } -} - -$t = new Tester('admin'); - -/* 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的项目 +//var_dump($project->checkStatusOff($closeId[0], $realEnd1));die; +r($project->checkStatusOff($closeId[0], $realEnd1)) && p() && e('1'); //关闭id为20状态不是closed的项目 +r($project->checkStatusOff($closeId[1], $realEnd1)) && p() && e('0'); //关闭id为26状态是closed的项目 +r($project->checkStatusOff($closeId[2], $realEnd1)) && p() && e('0'); //关闭id为41状态是suspended的项目 \ No newline at end of file diff --git a/test/model/project/getBudgetUnitList.php b/test/model/project/getBudgetUnitList.php index c72189a2e3..31d6c0d020 100755 --- a/test/model/project/getBudgetUnitList.php +++ b/test/model/project/getBudgetUnitList.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 1 */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->project = $tester->loadModel('project'); - } - - /** - * Check budget unit list. - * - * @param string $checkList - * @access public - * @return bool - */ - public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元')) - { - $budgetList = $this->project->getBudgetUnitList(); - foreach($budgetList as $enBudget => $zhBudget) - { - if($checkList[$enBudget] != $zhBudget) return false; - } - return true; - } -} - -$t = new Tester('admin'); +$t = new Project('admin'); /* GetBudgetUnitList(). */ -r($t->checkBudgetUnitList()) && p() && e('1'); //检查翻译 +r($t->checkBudgetUnitList()) && p() && e('1'); //检查翻译 \ No newline at end of file diff --git a/test/model/project/getByID.php b/test/model/project/getByID.php index 880749453d..1aaae57c76 100755 --- a/test/model/project/getByID.php +++ b/test/model/project/getByID.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > project1,project +获取不存在的项目 >> 0 +获取ID等于1的项目集 >> program1,program +获取不存在的项目集 >> 0 +获取ID等于101的冲刺 >> project1,sprint +获取不存在的冲刺 >> 0 +获取ID等于131的阶段 >> project31,stage +获取不存在的阶段 >> 0 +获取ID等于161的阶段 >> project61,kanban +获取不存在的看板 >> 0 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$t = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$getId = array(11, 0, 1, 0, 101, 0, 131, 0, 161, 0); - /** - * Get project by ID. - * - * @param int $projectID - * @access public - * @return object - */ - public function getProjectByID($projectID) - { - return $this->project->getByID($projectID); - } - - /** - * Get program by ID. - * - * @param int $programID - * @access public - * @return object - */ - public function getProgramByID($programID) - { - return $this->project->getByID($programID, 'program'); - } - - /** - * Get sprint by ID. - * - * @param int $sprintID - * @access public - * @return object - */ - public function getSprintByID($sprintID) - { - return $this->project->getByID($sprintID, 'sprint'); - } - - /** - * Get stage by ID. - * - * @param int $stageID - * @access public - * @return object - */ - public function getStageByID($stageID) - { - return $this->project->getByID($stageID, 'stage'); - } - - /** - * Get Kanban by ID, - * - * @param int $kanbanID - * @access public - * @return void - */ - public function getKanbanByID($kanbanID) - { - return $this->project->getByID($kanbanID, 'kanban'); - } -} - -$t = new Tester('admin'); - -/* Get project by ID. */ -r($t->getProjectByID(11)) && p('code,type') && e('project1,project'); //获取ID等于11的项目 -r($t->getProjectByID(0)) && p('code,type') && e('0'); //获取不存在的项目 - -/* Get program by ID. */ -r($t->getProgramByID(1)) && p('code,type') && e('program1,program'); //获取ID等于1的项目集 -r($t->getProgramByID(0)) && p('code,type') && e('0'); //获取不存在的项目集 - -/* Get sprint by ID. */ -r($t->getSprintByID(101)) && p('code,type') && e('project1,sprint'); //获取ID等于101的冲刺 -r($t->getSprintByID(0)) && p('code,type') && e('0'); //获取不存在的冲刺 - -/* Get stage by ID. */ -r($t->getStageByID(131)) && p('code,type') && e('project31,stage'); //获取ID等于131的阶段 -r($t->getStageByID(0)) && p('code,type') && e('0'); //获取不存在的阶段 - -/* Get Kanban by ID. */ -r($t->getKanbanByID(161)) && p('code,type') && e('project61,kanban'); //获取ID等于161的阶段 -r($t->getKanbanByID(0)) && p('code,type') && e('0'); //获取不存在的看板 +r($t->getProjectByID($getId[0])) && p('code,type') && e('project1,project'); //获取ID等于11的项目 +r($t->getProjectByID($getId[1])) && p('code,type') && e('0'); //获取不存在的项目 +r($t->getProgramByID($getId[2])) && p('code,type') && e('program1,program'); //获取ID等于1的项目集 +r($t->getProgramByID($getId[3])) && p('code,type') && e('0'); //获取不存在的项目集 +r($t->getSprintByID($getId[4])) && p('code,type') && e('project1,sprint'); //获取ID等于101的冲刺 +r($t->getSprintByID($getId[5])) && p('code,type') && e('0'); //获取不存在的冲刺 +r($t->getStageByID($getId[6])) && p('code,type') && e('project31,stage'); //获取ID等于131的阶段 +r($t->getStageByID($getId[7])) && p('code,type') && e('0'); //获取不存在的阶段 +r($t->getKanbanByID($getId[8])) && p('code,type') && e('project61,kanban'); //获取ID等于161的阶段 +r($t->getKanbanByID($getId[9])) && p('code,type') && e('0'); //获取不存在的看板 \ No newline at end of file diff --git a/test/model/project/getByIdList.php b/test/model/project/getByIdList.php index 624e3707eb..025a1555bc 100755 --- a/test/model/project/getByIdList.php +++ b/test/model/project/getByIdList.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 项目1;项目2;项目3 */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->project = $tester->loadModel('project'); - } +$t = new Project('admin'); - /** - * Check projectList get from getByIdList. - * - * @param array $projectIdList - * @param int $count - * @access public - * @return array - */ - public function getByIdList($projectIdList, $count) - { - $projectList = $this->project->getByIdList($projectIdList); - if(count($projectList) != $count) return false; - return $projectList; - } -} - -$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对应的项目名称 +r(($t->getByIdList($projectIdList, 3))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称 \ No newline at end of file diff --git a/test/model/project/getDataByProject.php b/test/model/project/getDataByProject.php index 1c657fe198..59c46ee40b 100755 --- a/test/model/project/getDataByProject.php +++ b/test/model/project/getDataByProject.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 129 +获取parent为11的首个项目的id >> 130 +获取parent为11的首个项目的id >> 131 +获取parent为10000的首个项目的id >> 0 +获取parent为131的首个版本的id >> 1 +获取parent为132的首个版本的id >> 6 +获取parent为10000的首个版本的id >> 0 +获取parent为132的首个发布的id >> 1 +获取parent为132的首个发布的id >> 6 +获取parent为10000的首个发布的id >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->project = $tester->loadModel('project'); - } - - /** - * Get executions from getDataByProject. - * - * @param int $projectID - * @param int $type - * @access public - * @return array - */ - public function getExecutionData($projectID, $type) - { - $executions = $this->project->getDataByProject(TABLE_EXECUTION, $projectID, $type); - if(empty($executions)) return false; - return $executions; - } - - /** - * Get builds from getDataByProject. - * - * @param int $projectID - * @access public - * @return array - */ - public function getBuildData($projectID) - { - $builds = $this->project->getDataByProject(TABLE_BUILD, $projectID); - if(empty($builds)) return false; - return $builds; - } - - /** - * Get releases from getDataByProject. - * - * @param int $projectID - * @access public - * @return array - */ - public function getReleaseData($projectID) - { - $releases = $this->project->getDataByProject(TABLE_RELEASE, $projectID); - if(empty($releases)) return false; - return $releases; - } -} /* 还有case bug testtask doc表要写,暂时表中没数据 */ -$t = new Tester(); -/* GetDataByProject(TABLE_EXECUTION, $projectID, $type). */ -r($t->getExecutionData(39)) && p('id') && e('129'); //获取parent为11首个项目的id -r($t->getExecutionData(40, 'sprint')) && p('id') && e('130'); //获取parent为11的首个项目的id -r($t->getExecutionData(41, 'stage')) && p('id') && e('131'); //获取parent为11的首个项目的id -r($t->getExecutionData(10000)) && p('id') && e('0'); //获取parent为10000的首个项目的id - -/* GetDataByProject(TABLE_BUILD, $projectID, $type). */ -r($t->getBuildData(131)) && p('id') && e('1'); //获取parent为131的首个版本的id -r($t->getBuildData(132)) && p('id') && e('6'); //获取parent为132的首个版本的id -r($t->getBuildData(10000)) && p('id') && e('0'); //获取parent为10000的首个版本的id - -/* GetDataByProject(TABLE_RELEASE, $projectID, $type). */ -r($t->getReleaseData(131)) && p('id') && e('1'); //获取parent为132的首个发布的id -r($t->getReleaseData(132)) && p('id') && e('6'); //获取parent为132的首个发布的id -r($t->getReleaseData(10000)) && p('id') && e('0'); //获取parent为10000的首个发布的id +$t = new Project('admin'); +$PID = array(39, 40, 'sprint', 41, 'stage', 10000, 131, 132, 10000, 131, 132, 10000); +r($t->getExecutionData($PID[0])) && p('id') && e('129'); //获取parent为11首个项目的id +r($t->getExecutionData($PID[1], $PID[2])) && p('id') && e('130'); //获取parent为11的首个项目的id +r($t->getExecutionData($PID[3], $PID[4])) && p('id') && e('131'); //获取parent为11的首个项目的id +r($t->getExecutionData($PID[5])) && p('id') && e('0'); //获取parent为10000的首个项目的id +r($t->getBuildData($PID[6])) && p('id') && e('1'); //获取parent为131的首个版本的id +r($t->getBuildData($PID[7])) && p('id') && e('6'); //获取parent为132的首个版本的id +r($t->getBuildData($PID[8])) && p('id') && e('0'); //获取parent为10000的首个版本的id +r($t->getReleaseData($PID[9])) && p('id') && e('1'); //获取parent为132的首个发布的id +r($t->getReleaseData($PID[10])) && p('id') && e('6'); //获取parent为132的首个发布的id +r($t->getReleaseData($PID[11])) && p('id') && e('0'); //获取parent为10000的首个发布的id \ No newline at end of file diff --git a/test/model/project/getInfoList.php b/test/model/project/getInfoList.php index 91a9e5de19..5148c673c2 100755 --- a/test/model/project/getInfoList.php +++ b/test/model/project/getInfoList.php @@ -8,8 +8,11 @@ title=测试 projectModel::getInfoList; cid=1 pid=1 + + */ $project = $tester->loadModel('project'); -$undoneProject = $project->getInfoList(); +$undoneProject = $project->getInfoList('wait'); +var_dump($undoneProject); diff --git a/test/model/project/getOverviewList.php b/test/model/project/getOverviewList.php index 45c6895b87..6004dea5ed 100755 --- a/test/model/project/getOverviewList.php +++ b/test/model/project/getOverviewList.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 15 +获取状态不为done和closed的项目 >> 15 +根据项目ID获取项目详情 >> 11 +获取不存在的项目 >> 0 +按照ID正序获取项目列表 >> 1 +按照项目名称倒序获取项目列表 >> 1 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$t = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$P_status = array('wait', 'undone', 11, 10000, 'id_asc', 'name_desc'); - /** - * Get project by status. - * - * @param string $status - * @access public - * @return int - */ - public function getBystatus($status) - { - $projects = $this->project->getOverviewList('byStatus', $status); - if(!$projects) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - if($status == 'undone') $status = 'wait,doing,suspended'; - - foreach($projects as $project) - { - if(strpos(",$status,", $project->status) === false) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'Error data.'; - - return $result; - } - } - - return count($projects); - } - - /** - * Get project list by order. - * - * @param string $orderBy - * @access public - * @return void - */ - public function getListByOrder($orderBy) - { - $projects = $this->project->getOverviewList('byStatus', 'wait', $orderBy); - return checkOrder($projects, $orderBy); - } - - /** - * Get project by ID. - * - * @param int $projectID - * @access public - * @return void - */ - public function getByID($projectID) - { - return $this->project->getOverviewList('byID', $projectID); - } -} - -$t = new Tester('admin'); - -/* GetOverviewList('byStatus'). */ -r($t->getByStatus('wait')) && p() && e('15'); // 获取未开始的项目 -r($t->getByStatus('undone')) && p() && e('15'); // 获取状态不为done和closed的项目 - -/* GetOverviewList('byID', $id). */ -r($t->getByID(11)) && p('11:id') && e('11'); // 根据项目ID获取项目详情 -r($t->getByID(10000)) && p('id') && e('0'); // 获取不存在的项目 - -/* GetOverviewList('byStatus', 'wait', $orderBy). */ -r($t->getListByOrder('id_asc')) && p() && e('1'); //按照ID正序获取项目列表 -r($t->getListByOrder('name_desc')) && p() && e('1'); // 按照项目名称倒序获取项目列表 +r($t->getByStatus($P_status[0])) && p() && e('15'); // 获取未开始的项目 +r($t->getByStatus($P_status[1])) && p() && e('15'); // 获取状态不为done和closed的项目 +r($t->getByID($P_status[2])) && p('11:id') && e('11'); // 根据项目ID获取项目详情 +r($t->getByID($P_status[3])) && p('id') && e('0'); // 获取不存在的项目 +r($t->getListByOrder($P_status[4])) && p() && e('1'); //按照ID正序获取项目列表 +r($t->getListByOrder($P_status[5])) && p() && e('1'); // 按照项目名称倒序获取项目列表 \ No newline at end of file diff --git a/test/model/project/getPairsByIdList.php b/test/model/project/getPairsByIdList.php index 487e72035e..1ecc019e2e 100755 --- a/test/model/project/getPairsByIdList.php +++ b/test/model/project/getPairsByIdList.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 3 +查找所有项目 >> 90 + */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$findProject = array(0,11,12,13); +$findAllPro = array(); - /** - * Get project pairs by ID list. - * - * @param array $IDList - * @access public - * @return int - */ - public function getByIdList($IDList) - { - $projects = $this->project->getPairsByIdList($IDList); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - foreach($projects as $projectID => $projectName) - { - if(!empty($IDList) and !in_array($projectID, $IDList)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'Error Data.'; - - return $result; - } - } - - return count($projects); - } -} - -$t = new Tester('admin'); - -r($t->getByIdList(array(0,11,12,13))) && p() && e('3'); //查找ID为0、11、12、13的项目 -r($t->getByIdList(array())) && p() && e('90'); //查找所有项目 +r($project->getByIdListFind($findProject)) && p() && e('3'); //查找ID为0、11、12、13的项目 +r($project->getByIdListFind($findAllPro)) && p() && e('90'); //查找所有项目 \ No newline at end of file diff --git a/test/model/project/getPairsByProgram.php b/test/model/project/getPairsByProgram.php index 80b082ba99..c9bb509194 100755 --- a/test/model/project/getPairsByProgram.php +++ b/test/model/project/getPairsByProgram.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 90 +查找独立项目 >> No data. +查找管理员可查看的所属项目集ID为1的项目 >> 9 +查找管理员可查看的所属项目集ID为1且状态为wait的项目 >> 3 +查找管理员可查看的所属项目集ID为1且状态不为closed的项目 >> 7 + */ -class Tester -{ - public function __construct($user) - { - global $tester; - - su($user); - $this->project = $tester->loadModel('project'); - } - - /** - * Get project pairs by programID. - * - * @param int $programID - * @access public - * @return int - */ - public function getByProgram($programID) - { - $projects = $this->project->getPairsByProgram($programID); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - return count($projects); - } - - /** - * Get project pairs by status. - * - * @param string $status - * @access public - * @return int - */ - public function getByStatus($status) - { - $projects = $this->project->getPairsByProgram(2, $status); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - return count($projects); - } - - /** - * Get project list by order. - * - * @param string $orderBy - * @access public - * @return int - */ +/* public function getListByOrder($orderBy) { $projects = $this->project->getPairsByProgram(3, 'doing', $orderBy); return checkOrder($projects, $orderBy); } -} +}*/ -$t = new Tester('admin'); +$t = new Project('admin'); -/* Get project list by program ID. */ -r($t->getByProgram('')) && p() && e('90'); //查找管理员可查看的所有项目 -r($t->getByProgram(0)) && p() && e('No data.'); //查找独立项目 -r($t->getByProgram(1)) && p() && e('9'); //查找管理员可查看的所属项目集ID为1的项目 +$t_project = array('', 0, 1, 'wait', 'noclosed'); -/* Get project list by status. */ -r($t->getByStatus('wait')) && p() && e('3'); //查找管理员可查看的所属项目集ID为1且状态为wait的项目 -r($t->getByStatus('noclosed')) && p() && e('7'); //查找管理员可查看的所属项目集ID为1且状态不为closed的项目 - -/* Get project list by order. */ -r($t->getListByOrder('id_desc')) && p() && e('1'); //按照ID降序排序查找项目 +r($t->getByProgram($t_project[0])) && p() && e('90'); //查找管理员可查看的所有项目 +r($t->getByProgram($t_project[1])) && p() && e('No data.'); //查找独立项目 +r($t->getByProgram($t_project[2])) && p() && e('9'); //查找管理员可查看的所属项目集ID为1的项目 +r($t->getByStatusPairs($t_project[3])) && p() && e('3'); //查找管理员可查看的所属项目集ID为1且状态为wait的项目 +r($t->getByStatusPairs($t_project[4])) && p() && e('7'); //查找管理员可查看的所属项目集ID为1且状态不为closed的项目 \ No newline at end of file diff --git a/test/model/project/getParentName.php b/test/model/project/getParentName.php index a6a17b398f..796627e8be 100755 --- a/test/model/project/getParentName.php +++ b/test/model/project/getParentName.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 项目集1 +获取id为1的项目父项目名字 >> 项目集1 +获取id为0的项目父项目名字 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->project = $tester->loadModel('project'); - } +$project = new Project('admin'); - /** - * Get parentName. - * - * @param int $projectID - * @access public - * @return array - */ - public function getParentName($projectID) - { - $program = $this->project->getParentName($projectID); - if(empty($program)) return false; - return $program; - } -} +$getName = array(11, 1, 0); -$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的项目父项目名字 +r($project->getParentName($getName[0])) && p('name') && e('项目集1'); //获取id为11的项目父项目名字 +r($project->getParentName($getName[1])) && p('name') && e('项目集1'); //获取id为1的项目父项目名字 +r($project->getParentName($getName[2])) && p('name') && e('0'); //获取id为0的项目父项目名字 \ No newline at end of file diff --git a/test/model/project/getProjectsConsumed.php b/test/model/project/getProjectsConsumed.php index 114702ce3b..9316dd3d84 100755 --- a/test/model/project/getProjectsConsumed.php +++ b/test/model/project/getProjectsConsumed.php @@ -1,6 +1,7 @@ #!/usr/bin/env php loadModel('project'); +var_dump(->getConsumed());die; >> 21.0 + >> 28.0 + >> 35.0 +*/ + +$projects = new Project('admin'); + +$getConsumed = array(11, 12, 13); + +//var_dump($projects->getConsumed($getConsumed));die; +r($projects->getConsumed($getConsumed)) && p('11:totalConsumed') && e('21.0'); +r($projects->getConsumed($getConsumed)) && p('12:totalConsumed') && e('28.0'); +r($projects->getConsumed($getConsumed)) && p('13:totalConsumed') && e('35.0'); \ No newline at end of file diff --git a/test/model/project/getStatData.php b/test/model/project/getStatData.php index 040edd1217..d5b5ce7483 100755 --- a/test/model/project/getStatData.php +++ b/test/model/project/getStatData.php @@ -8,5 +8,7 @@ title=测试 projectModel::checkHasContent; cid=1 pid=1 + + */ -$project = $tester->loadModel('project'); +$project = $tester->loadModel('project'); \ No newline at end of file diff --git a/test/model/project/getStats.php b/test/model/project/getStats.php index adeafb7553..b182cee1b1 100755 --- a/test/model/project/getStats.php +++ b/test/model/project/getStats.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 630 +查看未完成的执行 >> 0 +查看所有进行中的执行 >> 315 +查看所有进行中的执行 >> 315 +查看id为11项目的执行 >> 7 +查看id为12项目的执行 >> 7 */ -class Tester -{ - public function __construct($user) - { - global $tester; - su($user); - $this->project = $tester->loadModel('project'); - } +$t = new Project('admin'); - /** - * Get executions by status. - * - * @param string $status - * @access public - * @return int - */ - public function getByStatus($status) - { - $executions = $this->project->getStats(0, $status); - if(empty($executions)) return false; - if($status != 'all') - { - foreach($executions as $execution) - { - if($execution->status != $status) return false; - } - } - return count($executions); - } +$OpenImplement = array('all', 'undone', 'doing', 'wait', '11', '12'); - /** - * Get executions by project. - * - * @param int $projectID - * @access public - * @return int - */ - public function getByProject($projectID) - { - $executions = $this->project->getStats($projectID, 'all'); - if(empty($executions)) return false; - foreach($executions as $execution) - { - if($execution->project != $projectID) return false; - } - return count($executions); - } - - /** - * Get executions by order. - * - * @param string $orderBy - * @access public - * @return bool - */ - public function getListByOrder($orderBy) - { - $executions = $this->project->getStats(0, 'all', 0, 0, 30, $orderBy); - return checkOrder($executions, $orderBy); - } -} - - -$t = new Tester('admin'); - -/* GetStats(0, $status). */ -r($t->getByStatus('all')) && p() && e('600'); //查看所有执行 -r($t->getByStatus('undone')) && p() && e('0'); //查看未完成的执行 -r($t->getByStatus('doing')) && p() && e('300'); //查看所有进行中的执行 -r($t->getByStatus('wait')) && p() && e('300'); //查看所有进行中的执行 - -/* GetStats($projectID, 'all'). */ -r($t->getByProject('11')) && p() && e('7'); //查看id为11项目的执行 -r($t->getByProject('12')) && p() && e('7'); //查看id为12项目的执行 - -/* GetStats(0, 'all', 0, 0, 30, $orderBy). */ -r($t->getListByOrder(0, 'all', 0, 0, 30, 'id_desc')) && p() && e('1'); //按照项目id倒序获取项目列表 -r($t->getListByOrder(0, 'all', 0, 0, 30, 'name_asc')) && p() && e('1'); //按照项目名称正序获取项目列表 +r($t->getByStatusExe($OpenImplement[0])) && p() && e('630'); //查看所有执行 +r($t->getByStatusExe($OpenImplement[1])) && p() && e('0'); //查看未完成的执行 +r($t->getByStatusExe($OpenImplement[2])) && p() && e('315'); //查看所有进行中的执行 +r($t->getByStatusExe($OpenImplement[3])) && p() && e('315'); //查看所有进行中的执行 +r($t->getByProject($OpenImplement[4])) && p() && e('7'); //查看id为11项目的执行 +r($t->getByProject($OpenImplement[5])) && p() && e('7'); //查看id为12项目的执行 \ No newline at end of file diff --git a/test/model/project/getSwitcher.php b/test/model/project/getSwitcher.php index b454ac3b2d..1c11660186 100755 --- a/test/model/project/getSwitcher.php +++ b/test/model/project/getSwitcher.php @@ -4,13 +4,17 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; /** -title=测试 programModel::getSwitcher($projectID, $currentModule, $currentMethod); +title=测试 programModel::getSwitcher(, , ); cid=1 pid=1 +获取项目下拉菜单,项目列表页面没有项目下拉菜单 >> 0 +获取项目ID为11的迭代列表页面的项目下拉菜单,查看是否包含项目ID为11的名称 >> 项目1 + */ $project = $tester->loadModel('project'); +//var_dump($project->getSwitcher(11, 'project', 'browse'));die; r($project->getSwitcher(11, 'project', 'browse')) && p() && e('0'); //获取项目下拉菜单,项目列表页面没有项目下拉菜单 -r($project->getSwitcher(11, 'project', 'execution')) && p() && e("项目1"); //获取项目ID为11的迭代列表页面的项目下拉菜单,查看是否包含项目ID为11的名称 +r($project->getSwitcher(11, 'project', 'execution')) && p() && e("项目1"); //获取项目ID为11的迭代列表页面的项目下拉菜单,查看是否包含项目ID为11的名称 \ No newline at end of file diff --git a/test/model/project/getTeamMemberPairs.php b/test/model/project/getTeamMemberPairs.php index d172a4b222..8b28fa1bcd 100755 --- a/test/model/project/getTeamMemberPairs.php +++ b/test/model/project/getTeamMemberPairs.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 2 +获取id为1的项目团队成员个数 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su('admin'); - $this->project = $tester->loadModel('project'); - } +$getIdNub = array(11, 1); - /** - * Get team member pairs. - * - * @param int $projectID - * @access public - * @return int - */ - public function getTeamMemberPairs($projectID) - { - $members = array_filter($this->project->getTeamMemberPairs($projectID)); - if(empty($members)) return false; - return count($members); - } -} - -$t = new Tester('admin'); - -/* GetTeamMemberPairs($projectID). */ -r($t->getTeamMemberPairs(11)) && p() && e('2'); //获取id为11的项目团队成员个数 -r($t->getTeamMemberPairs(1)) && p() && e('0'); //获取id为1的项目团队成员个数 +r($project->getTeamMemberPairs($getIdNub[0])) && p() && e('2'); //获取id为11的项目团队成员个数 +r($project->getTeamMemberPairs($getIdNub[1])) && p() && e('0'); //获取id为1的项目团队成员个数 \ No newline at end of file diff --git a/test/model/project/getTeamMembers.php b/test/model/project/getTeamMembers.php index a2c5048aaf..9e4cc172b2 100755 --- a/test/model/project/getTeamMembers.php +++ b/test/model/project/getTeamMembers.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 0 +获取id为11的项目团队成员个数,开启新手引导 >> 1 */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } +$getNu = array(11, array('admin', 'pm92'), 11, array('admin'), true); - /** - * Check members. - * - * @param array $members - * @param array $users - * @access public - * @return bool - */ - public function checkMembers($members, $users) - { - foreach($users as $user) - { - if(!isset($members[$user])) return false; - } - return true; - } - - /** - * Get team memberm. - * - * @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); - $members = $this->project->getTeamMembers($projectID); - if(empty($members)) return false; - if(!empty($users)) $this->checkMembers($members, $users); - return count($members); - } -} - -$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的项目团队成员个数,开启新手引导 +r($project->getTeamMembers($getNu[0], $getNu[1])) && p() && e('0'); //获取id为11的项目团队成员个数 +r($project->getTeamMembers($getNu[2], $getNu[3], $getNu[4])) && p() && e('1'); //获取id为11的项目团队成员个数,开启新手引导 \ No newline at end of file diff --git a/test/model/project/getTotalBugByProject.php b/test/model/project/getTotalBugByProject.php index 0392338f08..38f95e1f4d 100755 --- a/test/model/project/getTotalBugByProject.php +++ b/test/model/project/getTotalBugByProject.php @@ -1,6 +1,7 @@ #!/usr/bin/env php > 3 + */ + +$project = new Project('admin'); + +$getBug = array(11, 12, 13, 14, 15, 16, 27); + +//var_dump($project->getTotalBugBy($getBug, 'active'));die; + +r($project->getTotalBugBy($getBug, 'active')) && p(11) && e('3'); //状态一致时正常打印id为11的项目bug数量 +r($project->getTotalBugBy($getBug, 'active')) && p(27) && e(''); //在状态status不一致的情况下,打印id为27的项目bug数量 \ No newline at end of file diff --git a/test/model/project/getTotalStoriesByProject.php b/test/model/project/getTotalStoriesByProject.php index ad9fc9d68e..45ad4b1bb7 100755 --- a/test/model/project/getTotalStoriesByProject.php +++ b/test/model/project/getTotalStoriesByProject.php @@ -8,5 +8,7 @@ title=测试 projectModel::getTotalStoriesByProject; cid=1 pid=1 + + */ -$project = $tester->loadModel('project'); +$project = $tester->loadModel('project'); \ No newline at end of file diff --git a/test/model/project/getWorkhour.php b/test/model/project/getWorkhour.php index 6f7c22467d..06c9268567 100755 --- a/test/model/project/getWorkhour.php +++ b/test/model/project/getWorkhour.php @@ -1,6 +1,7 @@ #!/usr/bin/env php loadModel('project'); + +$project = new Project('admin'); + +var_dump($project->getWorkHour(1));die; \ No newline at end of file diff --git a/test/model/project/isClickable.php b/test/model/project/isClickable.php index e8deca165a..f1ceff7bf8 100755 --- a/test/model/project/isClickable.php +++ b/test/model/project/isClickable.php @@ -8,6 +8,27 @@ title=测试 projectModel::isClickable(); cid=1 pid=1 +检查未开始项目的开始按钮 >> 1 +检查未开始项目的完成按钮 >> 1 +检查未开始项目的关闭按钮 >> 1 +检查未开始项目的暂停按钮 >> 1 +检查未开始项目的激活按钮 >> 0 +检查进行中项目的开始按钮 >> 0 +检查进行中项目的完成按钮 >> 1 +检查进行中项目的关闭按钮 >> 1 +检查进行中项目的暂停按钮 >> 1 +检查进行中项目的激活按钮 >> 0 +检查已暂停项目的开始按钮 >> 1 +检查已暂停项目的完成按钮 >> 0 +检查已暂停项目的关闭按钮 >> 1 +检查已暂停项目的暂停按钮 >> 0 +检查已暂停项目的激活按钮 >> 0 +检查已关闭项目的开始按钮 >> 0 +检查已关闭项目的完成按钮 >> 0 +检查已关闭项目的关闭按钮 >> 0 +检查已关闭项目的暂停按钮 >> 0 +检查已关闭项目的激活按钮 >> 1 + */ $projectModel = $tester->loadModel('project'); @@ -16,31 +37,25 @@ $waitProject = $projectModel->getByID(11); $doingProject = $projectModel->getByID(13); $suspendProject = $projectModel->getByID(17); $closedProject = $projectModel->getByID(18); +$status = array('start', 'finish', 'close', 'suspend', 'activate', ); -/* Check wait project. */ -r($projectModel->isClickable($waitProject, 'start')) && p() && e('1'); // 检查未开始项目的开始按钮 -r($projectModel->isClickable($waitProject, 'finish')) && p() && e('1'); // 检查未开始项目的完成按钮 -r($projectModel->isClickable($waitProject, 'close')) && p() && e('1'); // 检查未开始项目的关闭按钮 -r($projectModel->isClickable($waitProject, 'suspend')) && p() && e('1'); // 检查未开始项目的暂停按钮 -r($projectModel->isClickable($waitProject, 'activate')) && p() && e('0'); // 检查未开始项目的激活按钮 - -/* Check doing project. */ -r($projectModel->isClickable($doingProject, 'start')) && p() && e('0'); //检查进行中项目的开始按钮 -r($projectModel->isClickable($doingProject, 'finish')) && p() && e('1'); //检查进行中项目的完成按钮 -r($projectModel->isClickable($doingProject, 'close')) && p() && e('1'); //检查进行中项目的关闭按钮 -r($projectModel->isClickable($doingProject, 'suspend')) && p() && e('1'); //检查进行中项目的暂停按钮 -r($projectModel->isClickable($doingProject, 'activate')) && p() && e('0'); //检查进行中项目的激活按钮 - -/* Check suspend project. */ -r($projectModel->isClickable($suspendProject, 'start')) && p() && e('1'); //检查已暂停项目的开始按钮 -r($projectModel->isClickable($suspendProject, 'finish')) && p() && e('0'); //检查已暂停项目的完成按钮 -r($projectModel->isClickable($suspendProject, 'close')) && p() && e('1'); //检查已暂停项目的关闭按钮 -r($projectModel->isClickable($suspendProject, 'suspend')) && p() && e('0'); //检查已暂停项目的暂停按钮 -r($projectModel->isClickable($suspendProject, 'activate')) && p() && e('0'); //检查已暂停项目的激活按钮 - -/* Check closed project. */ -r($projectModel->isClickable($closedProject, 'start')) && p() && e('0'); //检查已关闭项目的开始按钮 -r($projectModel->isClickable($closedProject, 'finish')) && p() && e('0'); //检查已关闭项目的完成按钮 -r($projectModel->isClickable($closedProject, 'close')) && p() && e('0'); //检查已关闭项目的关闭按钮 -r($projectModel->isClickable($closedProject, 'suspend')) && p() && e('0'); //检查已关闭项目的暂停按钮 -r($projectModel->isClickable($closedProject, 'activate')) && p() && e('1'); //检查已关闭项目的激活按钮 +r($projectModel->isClickable($waitProject, $status[0])) && p() && e('1'); // 检查未开始项目的开始按钮 +r($projectModel->isClickable($waitProject, $status[1])) && p() && e('1'); // 检查未开始项目的完成按钮 +r($projectModel->isClickable($waitProject, $status[2])) && p() && e('1'); // 检查未开始项目的关闭按钮 +r($projectModel->isClickable($waitProject, $status[3])) && p() && e('1'); // 检查未开始项目的暂停按钮 +r($projectModel->isClickable($waitProject, $status[4])) && p() && e('0'); // 检查未开始项目的激活按钮 +r($projectModel->isClickable($doingProject, $status[0])) && p() && e('0'); // 检查进行中项目的开始按钮 +r($projectModel->isClickable($doingProject, $status[1])) && p() && e('1'); // 检查进行中项目的完成按钮 +r($projectModel->isClickable($doingProject, $status[2])) && p() && e('1'); // 检查进行中项目的关闭按钮 +r($projectModel->isClickable($doingProject, $status[3])) && p() && e('1'); // 检查进行中项目的暂停按钮 +r($projectModel->isClickable($doingProject, $status[4])) && p() && e('0'); // 检查进行中项目的激活按钮 +r($projectModel->isClickable($suspendProject, $status[0])) && p() && e('1'); // 检查已暂停项目的开始按钮 +r($projectModel->isClickable($suspendProject, $status[1])) && p() && e('0'); // 检查已暂停项目的完成按钮 +r($projectModel->isClickable($suspendProject, $status[2])) && p() && e('1'); // 检查已暂停项目的关闭按钮 +r($projectModel->isClickable($suspendProject, $status[3])) && p() && e('0'); // 检查已暂停项目的暂停按钮 +r($projectModel->isClickable($suspendProject, $status[4])) && p() && e('0'); // 检查已暂停项目的激活按钮 +r($projectModel->isClickable($closedProject, $status[0])) && p() && e('0'); // 检查已关闭项目的开始按钮 +r($projectModel->isClickable($closedProject, $status[1])) && p() && e('0'); // 检查已关闭项目的完成按钮 +r($projectModel->isClickable($closedProject, $status[2])) && p() && e('0'); // 检查已关闭项目的关闭按钮 +r($projectModel->isClickable($closedProject, $status[3])) && p() && e('0'); // 检查已关闭项目的暂停按钮 +r($projectModel->isClickable($closedProject, $status[4])) && p() && e('1'); // 检查已关闭项目的激活按钮 \ No newline at end of file diff --git a/test/model/project/saveState.php b/test/model/project/saveState.php index dc6b68ff5d..997ba87b53 100755 --- a/test/model/project/saveState.php +++ b/test/model/project/saveState.php @@ -8,6 +8,8 @@ title=测试 programModel::saveState; cid=1 pid=1 + + */ -$project = $tester->loadModel('project'); +$project = $tester->loadModel('project'); \ No newline at end of file diff --git a/test/model/project/start.php b/test/model/project/start.php index fdd9ba0fcd..7ae995d613 100755 --- a/test/model/project/start.php +++ b/test/model/project/start.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 1 +开始id为83状态是wait的项目 >> 1 +开始id为82状态是closed的项目 >> 0 +开始id为85状态是doing的项目 >> 0 */ -class Tester -{ - public function __construct($user) - { - global $tester; +$project = new Project('admin'); - su($user); - $this->project = $tester->loadModel('project'); - } - - /** - * Check project status after start a project. - * - * @param int $projectID - * @access public - * @return bool - */ - public function checkStatus($projectID) - { - $oldProject = $this->project->getById($projectID); - if($oldProject->status != 'suspended' and $oldProject->status != 'wait') return false; - - $change = $this->project->start($projectID); - - $project = $this->project->getById($projectID); - if($project->status != 'doing') return false; - - return true; - } -} - -$t = new Tester('admin'); - -/* Start($projectID). */ -r($t->checkStatus(81)) && p() && e('1'); // 开始id为81状态是suspended的项目 -r($t->checkStatus(83)) && p() && e('1'); // 开始id为83状态是wait的项目 -r($t->checkStatus(82)) && p() && e('0'); // 开始id为82状态是closed的项目 -r($t->checkStatus(85)) && p() && e('0'); // 开始id为85状态是doing的项目 +$statusId = array(81, 83, 82, 85); +r($project->checkStatusBegin($statusId[0])) && p() && e('1'); // 开始id为81状态是suspended的项目(代码缺失elBegan参数,报警告) +r($project->checkStatusBegin($statusId[1])) && p() && e('1'); // 开始id为83状态是wait的项目 +r($project->checkStatusBegin($statusId[2])) && p() && e('0'); // 开始id为82状态是closed的项目 +r($project->checkStatusBegin($statusId[3])) && p() && e('0'); // 开始id为85状态是doing的项目 \ No newline at end of file diff --git a/test/model/project/suspend.php b/test/model/project/suspend.php index b5189773aa..15c0a2a08d 100755 --- a/test/model/project/suspend.php +++ b/test/model/project/suspend.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 1 +暂停id为73状态是suspended的项目 >> 0 +暂停id为74状态是closed的项目 >> 0 */ - +/* class Tester { public function __construct($user) @@ -24,29 +27,27 @@ class Tester /** * Check project status after suspend a project. - * - * @param int $projectID + * + * @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的项目 +$t = new Project('admin'); +r($t->checkStatusStop(56)) && p() && e('1'); // 暂停id为56状态是doing的项目 +r($t->checkStatusStop(73)) && p() && e('0'); // 暂停id为73状态是suspended的项目 +r($t->checkStatusStop(74)) && p() && e('0'); // 暂停id为74状态是closed的项目 \ No newline at end of file diff --git a/test/ztest b/test/ztest index 8a30767bef..d6f9f9680d 100755 --- a/test/ztest +++ b/test/ztest @@ -22,14 +22,22 @@ switch($argv[1]) case 'program': ztfRun('model/program'); break; + case 'product': + ztfRun('model/product'); + break; + case 'project': + ztfRun('model/project'); + break; case 'task': ztfRun('model/task'); + break; case 'execution': ztfRun('model/execution'); break; case 'model': ztfRun('model'); break; + default: ztfExtract($argv[1]); system("php " . $argv[1]); From a25fd822bdc08c75fb4ca74693753f4733a0af0c Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 14 Mar 2022 09:55:44 +0800 Subject: [PATCH 7/8] * Fix bug #20702,20698,20642. --- extension/lite/execution/ext/model/lite.php | 2 +- extension/lite/story/ext/view/batchedit.html.php | 4 +--- module/common/view/datatable.fix.html.php | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/extension/lite/execution/ext/model/lite.php b/extension/lite/execution/ext/model/lite.php index af0eb526da..3773fe3daa 100644 --- a/extension/lite/execution/ext/model/lite.php +++ b/extension/lite/execution/ext/model/lite.php @@ -116,7 +116,7 @@ public function getTRActions($currentMethod) $TRActions = ''; $TRActions .= "