diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..957236940c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "extension/qucheng"] + path = extension/qucheng + url = https://gitlab.zcorp.cc/easycorp/qucheng.git diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index 90476c5493..bd32975f52 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -58,7 +58,7 @@ class productEntry extends Entry $product->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'bug', 0, 'all'); break; case 'builds': - $product->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone,withbranch'); + $product->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone,withbranch', $this->param('object', 0), $this->param('objectType', 'execution')); break; case 'actions': $product->addComment = common::hasPriv('action', 'comment') ? true : false; diff --git a/config/config.php b/config/config.php index 6271d1a45d..8bbb213f6a 100644 --- a/config/config.php +++ b/config/config.php @@ -146,7 +146,7 @@ $config->file->allowed = 'txt,doc,docx,dot,wps,wri,pdf,ppt,pptx,xls,xlsx,ett $config->file->storageType = 'fs'; // fs or s3 /* Upload settings. */ -$config->allowedTags = '
+ +project);?> @@ -24,7 +22,7 @@ - id", "" . $lang->design->linkCommit, '_blank', "class='btn btn-primary'");?> + id", "" . $lang->design->linkCommit, '', "class='btn btn-primary' id='linkCommit'");?> commit)):?> diff --git a/module/doc/css/common.css b/module/doc/css/common.css index abf19b59c7..38835f6e61 100644 --- a/module/doc/css/common.css +++ b/module/doc/css/common.css @@ -99,3 +99,5 @@ ol, ul {margin-bottom: 0} .tree li.active > .tree-group a {font-weight: 700; color: #0c64eb;} .tree li>.list-toggle {left: -4px; top: 0;} + +.fullscreen-close {top: 8px !important;} diff --git a/module/doc/css/createlib.css b/module/doc/css/createlib.css index 7ceca80ca3..7a5b6bbfba 100644 --- a/module/doc/css/createlib.css +++ b/module/doc/css/createlib.css @@ -7,4 +7,4 @@ table {width: 90% !important;} #product_chosen {width: 50% !important;} #execution_chosen {width: 50% !important;} -#whiteListBox .input-group:last-child {margin-top: 10px;} +#groups_chosen.chosen-container .chosen-results, #users_chosen.chosen-container .chosen-results {max-height: 160px;} diff --git a/module/doc/css/edit.css b/module/doc/css/edit.css index 529cf1c6e7..0863577432 100644 --- a/module/doc/css/edit.css +++ b/module/doc/css/edit.css @@ -1,3 +1,5 @@ #whiteListBox .input-group:last-child {margin-top: 10px;} #mainContent .main-header h2 {width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} .fullscreen-save, .markdown-fullscreen-save {position: fixed; top: 10px; right: 30px; z-index: 999999;} + +.modal-header .fullscreen-save, .markdown-fullscreen-save {top: 5px; right: 60px;} diff --git a/module/doc/css/editlib.css b/module/doc/css/editlib.css index b69d2fa8e3..2acde0e1ba 100644 --- a/module/doc/css/editlib.css +++ b/module/doc/css/editlib.css @@ -4,3 +4,4 @@ form {margin-right: 30px;} #whiteListBox .input-group:last-child {margin-top: 10px;} .center-block {margin-top: 20px;} +#groups_chosen.chosen-container .chosen-results, #users_chosen.chosen-container .chosen-results {max-height: 160px;} diff --git a/module/doc/js/edit.js b/module/doc/js/edit.js index 8c5c3451c3..747ea15f26 100644 --- a/module/doc/js/edit.js +++ b/module/doc/js/edit.js @@ -82,6 +82,34 @@ $(function() } }, 200); } + else + { + setTimeout(function() + { + if($('a[title="Fullscreen"]').hasClass('active')) + { + $('.main-header').hide(); + $('#submit').addClass('markdown-fullscreen-save'); + $('#submit').removeClass('btn-wide'); + $('#mainContent .fullscreen').css('padding-top', '8px'); + $('#mainContent .fullscreen').css('height', '40px'); + $('.CodeMirror-fullscreen').css('top', '40px'); + $('.editor-preview-side').css('top', '40px'); + $('#submit').data('placement', 'left'); + parent.$('.modal-header > .close').addClass('fullscreen-close'); + } + else + { + $('.main-header').show(); + $('#submit').removeClass('markdown-fullscreen-save'); + $('#mainContent .editor-toolbar').css('padding', '1px'); + $('#mainContent .editor-toolbar').css('height', '30px'); + $('.CodeMirror').css('top', '0px'); + $('.editor-preview-side').css('top', '0px'); + parent.$('.modal-header > .close').removeClass('fullscreen-close'); + } + }, 200); + } }); }) diff --git a/module/execution/control.php b/module/execution/control.php index 5977fb331c..98c1b23534 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1263,24 +1263,7 @@ class execution extends control */ public function create($projectID = '', $executionID = 0, $copyExecutionID = '', $planID = 0, $confirm = 'no', $productID = 0, $extra = '') { - /* Set menu. */ - if($this->app->tab == 'project') - { - if(!empty($copyExecutionID)) $projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($copyExecutionID)->fetch('project'); - - $projectID = $this->project->saveState($projectID, $this->project->getPairsByProgram()); - $this->project->setMenu($projectID); - } - elseif($this->app->tab == 'execution') - { - $selectedExecutionID = $executionID; - if($this->config->systemMode == 'new') $selectedExecutionID = key($this->executions); - $this->execution->setMenu($selectedExecutionID); - } - elseif($this->app->tab == 'doc') - { - unset($this->lang->doc->menu->execution['subMenu']); - } + if($this->app->tab == 'doc') unset($this->lang->doc->menu->execution['subMenu']); $project = $this->project->getByID($projectID); if(!empty($project) and $project->model == 'kanban') @@ -1988,7 +1971,7 @@ class execution extends control if($execution->type == 'kanban') { if(defined('RUN_MODE') && RUN_MODE == 'api') return print($this->fetch('execution', 'kanban', "executionID=$executionID")); - return $this->locate(inlink('kanban', "executionID=$executionID")); + return print(js::locate(inlink('kanban', "executionID=$executionID"))); } $this->app->loadLang('program'); @@ -2058,7 +2041,7 @@ class execution extends control $this->lang->execution->menu = new stdclass(); $execution = $this->commonAction($executionID); - if($execution->type != 'kanban') return $this->locate(inlink('view', "executionID=$executionID")); + if($execution->type != 'kanban') return print(js::locate(inlink('view', "executionID=$executionID"))); $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, 0, $groupBy); $executionActions = array(); @@ -3296,7 +3279,8 @@ class execution extends control $this->view->project = $project; $this->project->setMenu($projectID); - if(!empty($project->model) and $project->model == 'kanban' and !(defined('RUN_MODE') and RUN_MODE == 'api')) return $this->locate($this->createLink('project', 'index', "projectID=$projectID")); + if(!$projectID) return print(js::locate($this->createLink('project', 'browse'))); + if(!empty($project->model) and $project->model == 'kanban' and !(defined('RUN_MODE') and RUN_MODE == 'api')) return print(js::locate($this->createLink('project', 'index', "projectID=$projectID"))); } if($this->app->viewType == 'mhtml') diff --git a/module/execution/model.php b/module/execution/model.php index 37a8107aaf..dcf6ea67fb 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1680,9 +1680,9 @@ class executionModel extends model $execution->days = $execution->days ? $execution->days : ''; $execution->totalHours = $this->dao->select('sum(days * hours) AS totalHours')->from(TABLE_TEAM)->where('root')->eq($execution->id)->andWhere('type')->eq('execution')->fetch('totalHours'); - $execution->totalEstimate = round($total->totalEstimate, 1); - $execution->totalConsumed = round($total->totalConsumed, 1); - $execution->totalLeft = round($total->totalLeft - $closedTotalLeft, 1); + $execution->totalEstimate = round((float)$total->totalEstimate, 1); + $execution->totalConsumed = round((float)$total->totalConsumed, 1); + $execution->totalLeft = round((float)($total->totalLeft - $closedTotalLeft), 1); $execution = $this->loadModel('file')->replaceImgURL($execution, 'desc'); if($setImgSize) $execution->desc = $this->file->setImgSize($execution->desc); diff --git a/module/group/control.php b/module/group/control.php index d3737d9e81..a8b5c03a90 100644 --- a/module/group/control.php +++ b/module/group/control.php @@ -181,7 +181,7 @@ class group extends control if($type == 'byModule') $result = $this->group->updatePrivByModule(); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse'))); + return print(js::alert($this->lang->saveSuccess) . js::execute('window.parent.location.reload()')); } if($type == 'byGroup') diff --git a/module/my/css/doc.css b/module/my/css/doc.css new file mode 100644 index 0000000000..cf7292e208 --- /dev/null +++ b/module/my/css/doc.css @@ -0,0 +1 @@ +.fullscreen-close {top: 8px !important;} diff --git a/module/program/model.php b/module/program/model.php index 9def3df994..f7f4f5bb8b 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -240,6 +240,14 @@ class programModel extends model foreach($products as $product) { $product->plans = zget($plans, $product->id, array()); + + /* Convert predefined HTML entities to characters. */ + !empty($product->plans) && array_map(function($planVal) + { + return $planVal->title = htmlspecialchars_decode($planVal->title, ENT_QUOTES); + }, + $product->plans); + $product->releases = zget($releases, $product->id, array()); $projects = zget($projectGroup, $product->id, array()); foreach($projects as $project) diff --git a/module/project/js/build.js b/module/project/js/build.js index 2079622260..e8a9ea9c64 100644 --- a/module/project/js/build.js +++ b/module/project/js/build.js @@ -5,7 +5,9 @@ $(function() if(executions.length == 0) { alert(createExecution); - location.href = createLink('execution', 'create', 'projectID=' + projectID); + var link = createLink('execution', 'create', 'projectID=' + projectID); + + window.parent.$.apps.open(link, 'execution'); return false; } }); diff --git a/module/project/model.php b/module/project/model.php index 3231360439..9e38401331 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2187,6 +2187,20 @@ class projectModel extends model if($task->status != 'cancel' and $task->status != 'closed') $hour->totalLeft += $task->left; } $hours[$executionID] = $hour; + + if($executions[$executionID]->type == 'stage' and $executions[$executionID]->grade == 2) + { + $stageParent = $executions[$executionID]->parent; + if(!isset($hours[$stageParent])) + { + $hours[$stageParent] = clone $hour; + continue; + } + + $hours[$stageParent]->totalEstimate += $hour->totalEstimate; + $hours[$stageParent]->totalConsumed += $hour->totalConsumed; + $hours[$stageParent]->totalLeft += $hour->totalLeft; + } } /* Compute totalReal and progress. */ diff --git a/module/story/control.php b/module/story/control.php index d8ed07fb70..fcde54748b 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2345,23 +2345,26 @@ class story extends control } } - /* Get users, products and executions. */ - $users = $this->loadModel('user')->getPairs('noletter'); - $products = $this->product->getPairs('nocode'); + /* Get users, products and relations. */ + $users = $this->loadModel('user')->getPairs('noletter'); + $products = $this->product->getPairs('nocode'); + $relations = $this->story->getStoryRelationByIds($storyIdList, $type); /* Get related objects id lists. */ $relatedProductIdList = array(); $relatedStoryIdList = array(); $relatedPlanIdList = array(); $relatedBranchIdList = array(); - $relatedStoryIDs = array(); + $relatedStoryIds = array(); foreach($stories as $story) { $relatedProductIdList[$story->product] = $story->product; $relatedPlanIdList[$story->plan] = $story->plan; $relatedBranchIdList[$story->branch] = $story->branch; - $relatedStoryIDs[$story->id] = $story->id; + $relatedStoryIds[$story->id] = $story->id; + + if(isset($relations[$story->id])) $story->linkStories = $story->linkStories . ',' . $relations[$story->id]; /* Process related stories. */ $relatedStories = $story->childStories . ',' . $story->linkStories . ',' . $story->duplicateStory; @@ -2372,14 +2375,14 @@ class story extends control } } - $storyTasks = $this->loadModel('task')->getStoryTaskCounts($relatedStoryIDs); - $storyBugs = $this->loadModel('bug')->getStoryBugCounts($relatedStoryIDs); - $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($relatedStoryIDs); + $storyTasks = $this->loadModel('task')->getStoryTaskCounts($relatedStoryIds); + $storyBugs = $this->loadModel('bug')->getStoryBugCounts($relatedStoryIds); + $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($relatedStoryIds); /* Get related objects title or names. */ $productsType = $this->dao->select('id, type')->from(TABLE_PRODUCT)->where('id')->in($relatedProductIdList)->fetchPairs(); $relatedPlans = $this->dao->select('id, title')->from(TABLE_PRODUCTPLAN)->where('id')->in(join(',', $relatedPlanIdList))->fetchPairs(); - $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); + $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->in($storyIdList)->andWhere('extra')->ne('editor')->fetchGroup('objectID'); $relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in($storyIdList)->orderBy('version desc')->fetchGroup('story'); $relatedBranch = array('0' => $this->lang->branch->main) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs(); @@ -2448,10 +2451,12 @@ class story extends control if($story->linkStories) { - $tmpLinkStories = array(); + $tmpLinkStories = array(); $linkStoriesIdList = explode(',', $story->linkStories); foreach($linkStoriesIdList as $linkStoryID) { + if(empty($linkStoryID)) continue; + $linkStoryID = trim($linkStoryID); $tmpLinkStories[] = isset($relatedStories[$linkStoryID]) ? $relatedStories[$linkStoryID] : $linkStoryID; } diff --git a/module/story/model.php b/module/story/model.php index 11dd55677d..68b21da66d 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3204,31 +3204,34 @@ class storyModel extends model /** * Check need confirm. * - * @param array $dataList + * @param array|object $object * @access public - * @return array + * @return array|object */ - public function checkNeedConfirm($dataList) + public function checkNeedConfirm($data) { + $objectList = is_object($data) ? array($data->id => $data) : $data; + $storyIdList = array(); $storyVersionList = array(); - foreach($dataList as $key => $data) + + foreach($objectList as $key => $object) { - $data->needconfirm = false; - if($data->story) + $object->needconfirm = false; + if($object->story) { - $storyIdList[$key] = $data->story; - $storyVersionList[$key] = $data->storyVersion; + $storyIdList[$key] = $object->story; + $storyVersionList[$key] = $object->storyVersion; } } $stories = $this->dao->select('id,version')->from(TABLE_STORY)->where('id')->in($storyIdList)->andWhere('status')->eq('active')->fetchPairs('id', 'version'); foreach($storyIdList as $key => $storyID) { - if(isset($stories[$storyID]) and $stories[$storyID] > $storyVersionList[$key]) $dataList[$key]->needconfirm = true; + if(isset($stories[$storyID]) and $stories[$storyID] > $storyVersionList[$key]) $objectList[$key]->needconfirm = true; } - return $dataList; + return is_object($data) ? current($objectList) : $objectList; } /** @@ -4390,6 +4393,30 @@ class storyModel extends model return $story; } + /** + * Get story relation by Ids. + * + * @param array $storyIdList + * @param string $storyType + * @access public + * @return array + */ + public function getStoryRelationByIds($storyIdList, $storyType) + { + $conditionField = $storyType == 'story' ? 'BID' : 'AID'; + $storyType = $storyType == 'story' ? 'BID, GROUP_CONCAT(`AID` SEPARATOR ",")' : 'AID, GROUP_CONCAT(`BID` SEPARATOR ",")'; + + $relations = $this->dao->select($storyType)->from(TABLE_RELATION) + ->where('AType')->eq('requirement') + ->andWhere('BType')->eq('story') + ->andWhere('relation')->eq('subdivideinto') + ->andWhere($conditionField)->in($storyIdList) + ->groupBy($conditionField) + ->fetchPairs(); + + return $relations; + } + /** * Link a story. * diff --git a/module/story/view/review.html.php b/module/story/view/review.html.php index 34aa91a1cd..a32cd350d9 100644 --- a/module/story/view/review.html.php +++ b/module/story/view/review.html.php @@ -25,7 +25,7 @@ story->reviewedDate;?> - + story->reviewResult;?> diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index 4f7b66447c..9d43318036 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -413,7 +413,7 @@ story->reviewedDate;?> - reviewedBy) echo date('Y-m-d', strtotime($story->reviewedDate))?> + reviewedBy) echo $story->reviewedDate;?> story->closedBy;?> diff --git a/module/task/control.php b/module/task/control.php index 4b9de25297..25ce86ce2a 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -833,7 +833,7 @@ class task extends control } $execution = $this->execution->getById($task->execution); - if(!isonlybody() and $execution->type == 'kanban') return $this->locate($this->createLink('execution', 'kanban', "executionID=$execution->id")); + if(!isonlybody() and $execution->type == 'kanban') return print(js::locate($this->createLink('execution', 'kanban', "executionID=$execution->id"))); $this->session->project = $task->project; diff --git a/module/testcase/control.php b/module/testcase/control.php index e2572d65ef..e2fb8a6aed 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -680,6 +680,7 @@ class testcase extends control $caseID = (int)$caseID; $case = $this->testcase->getById($caseID, $version); + $case = $this->loadModel('story')->checkNeedConfirm($case); if(!$case) { if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found')); diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index b87f82e4bf..a849bea77f 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -114,6 +114,7 @@ deleted):?> ";?> + needconfirm):?> createLink('caselib', 'createCase', "libID=$case->lib&moduleID=$case->module¶m=$case->id"), "", '', "class='btn' title='{$lang->testcase->copy}'"); common::printIcon('testcase', 'delete', "caseID=$case->id", $case, 'button', 'trash', 'hiddenwin', ''); ?> + needconfirm):?> + id", $case, 'list', 'confirm', 'hiddenwin', '', '', '', $this->lang->confirm);?> + diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index 8e5da3fbbe..74b54c4461 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -90,7 +90,7 @@ $status = $this->session->testTaskVersionStatus; id"), $task->name);?> productName?> executionName?> - build == 'trunk' || empty($task->buildName)) ? $lang->trunk : html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName, '', "data-group=execution");?> + build == 'trunk' || empty($task->buildName)) ? $lang->trunk : html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName, '', "data-group=execution");?> owner);?> begin?> end?> diff --git a/module/tree/model.php b/module/tree/model.php index a67643938f..ae318d04cb 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -176,7 +176,7 @@ class treeModel extends model ksort($treeMenu); $topMenu = @array_shift($treeMenu); - $topMenu = explode("\n", trim($topMenu)); + $topMenu = explode("\n", trim((string)$topMenu)); $lastMenu[] = '/'; foreach($topMenu as $menu) { diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 960f4aeb1c..335390a852 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -718,7 +718,7 @@ class upgrade extends control } $extFiles = $this->upgrade->getExtFiles(); - if(!empty($extFiles) and $skipMoveFile == 'no') return $this->locate(inlink('moveExtFiles', "fromVersion=$fromVersion")); + if(!empty($extFiles) and $skipMoveFile == 'no') return print(js::locate(inlink('moveExtFiles', "fromVersion=$fromVersion"))); $response = $this->upgrade->removeEncryptedDir(); if($response['result'] == 'fail') diff --git a/module/user/model.php b/module/user/model.php index 3ece501473..59e5c5c79b 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -424,7 +424,7 @@ class userModel extends model $data[$i]->type = 'inside'; $data[$i]->realname = $users->realname[$i]; $data[$i]->role = $role; - $data[$i]->group = in_array('ditto', $users->group[$i]) ? (isset($prev['group']) ? $prev['group'] : '') : $users->group[$i]; + $data[$i]->group = in_array('ditto', isset($users->group[$i]) ? $users->group[$i] : array()) ? (isset($prev['group']) ? $prev['group'] : '') : $users->group[$i]; $data[$i]->email = $users->email[$i]; $data[$i]->gender = $users->gender[$i]; $data[$i]->password = md5(trim($users->password[$i])); diff --git a/test/class/kanban.class.php b/test/class/kanban.class.php index 4127ec94be..1a61562ed8 100644 --- a/test/class/kanban.class.php +++ b/test/class/kanban.class.php @@ -138,13 +138,27 @@ class kanbanTest return $object; } - public function splitColumnTest($columnID) + /** + * Test split column. + * + * @param int $columnID + * @param array $param + * @access public + * @return int + */ + public function splitColumnTest($columnID, $param) { + foreach($param as $key => $value) $_POST[$key] = $value; + $objects = $this->objectModel->splitColumn($columnID); + unset($_POST); + if(dao::isError()) return dao::getError(); - return $objects; + global $tester; + $childs = $tester->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('`parent`')->eq($columnID)->fetchAll(); + return count($childs); } /** @@ -755,13 +769,42 @@ class kanbanTest return $object; } - public function updateSpaceTest($spaceID, $type = '') + /** + * Test update a space. + * + * @param int $spaceID + * @param string $type + * @param array $param + * @access public + * @return array + */ + public function updateSpaceTest($spaceID, $type = '', $param = array()) { - $objects = $this->objectModel->updateSpace($spaceID, $type = ''); + global $tester; + $object = $tester->dao->select('`type`,`name`,`owner`,`team`,`desc`,`whitelist`')->from(TABLE_KANBANSPACE)->where('`id`')->eq($spaceID)->fetch(); + $object->team = explode(',', $object->team); + $object->whitelist = explode(',', $object->whitelist); + + foreach($object as $field => $value) + { + if(in_array($field, array_keys($param))) + { + $_POST[$field] = $param[$field]; + } + else + { + $_POST[$field] = $value; + } + } + + $change = $this->objectModel->updateSpace($spaceID, $type); + if($change == array()) $change = '没有数据更新'; + + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + return $change; } /** @@ -774,6 +817,11 @@ class kanbanTest */ public function getLanePairsByRegionTest($regionID, $type = 'all') { + global $tester; + + + foreach($param as $key => $value) $_POST[$key] = $value; + $objects = $this->objectModel->getLanePairsByRegion($regionID, $type); if(dao::isError()) return dao::getError(); @@ -846,13 +894,39 @@ class kanbanTest return $object; } - public function updateTest($kanbanID) + /** + * Test update a kanban. + * + * @param int $kanbanID + * @param array $param + * @access public + * @return array + */ + public function updateTest($kanbanID, $param) { - $objects = $this->objectModel->update($kanbanID); + global $tester; + $object = $tester->dao->select('`space`,`name`,`owner`,`team`,`desc`')->from(TABLE_KANBAN)->where('`id`')->eq($kanbanID)->fetch(); + $object->team = explode(',', $object->team); + + foreach($object as $field => $value) + { + if(in_array($field, array_keys($param))) + { + $_POST[$field] = $param[$field]; + } + else + { + $_POST[$field] = $value; + } + } + + $change = $this->objectModel->update($kanbanID); + if($change == array()) $change = '没有数据更新'; + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + return $change; } /** @@ -1031,22 +1105,51 @@ class kanbanTest return count($objects); } - public function updateRegionTest($regionID) + /** + * Test update a region. + * + * @param int $regionID + * @param string $name + * @access public + * @return array + */ + public function updateRegionTest($regionID, $name) { - $objects = $this->objectModel->updateRegion($regionID); + $_POST['name'] = $name; + $change = $this->objectModel->updateRegion($regionID); + if($change == array()) $change = '没有数据更新'; + + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + return $change; } + /** + * Test update kanban lane. + * + * @param int $executionID + * @param string $laneType + * @param int $cardID + * @access public + * @return string + */ public function updateLaneTest($executionID, $laneType, $cardID = 0) { - $objects = $this->objectModel->updateLane($executionID, $laneType, $cardID = 0); + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_KANBANLANE)->where('type')->ne('common')->andWhere('execution')->eq($executionID)->fetch(); + if(empty($objects)) $this->objectModel->createExecutionLane($executionID); + + $this->objectModel->updateLane($executionID, $laneType, $cardID); if(dao::isError()) return dao::getError(); - return $objects; + $objects = $tester->dao->select('*')->from(TABLE_KANBANCELL)->where('kanban')->eq($executionID)->andWhere('type')->eq($laneType)->fetchAll(); + $cards = ''; + foreach($objects as $object) $cards .= $object->cards; + $cards = preg_replace('#,+#', ',', $cards); + return $cards; } /** @@ -1074,22 +1177,28 @@ class kanbanTest return $cards; } - public function updateLaneColumnTest($columnID, $column) + /** + * Test update a column. + * + * @param int $columnID + * @param string $name + * @param string $color + * @access public + * @return array + */ + public function updateLaneColumnTest($columnID, $name, $color) { - $objects = $this->objectModel->updateLaneColumn($columnID, $column); + $_POST['name'] = $name; + $_POST['color'] = $color; + $column = $this->objectModel->getColumnByID($columnID); + $change = $this->objectModel->updateLaneColumn($columnID, $column); + if($change == array()) $change = '没有数据更新'; + + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; - } - - public function updateLaneOrderTest($executionID, $currentType, $targetType) - { - $objects = $this->objectModel->updateLaneOrder($executionID, $currentType, $targetType); - - if(dao::isError()) return dao::getError(); - - return $objects; + return $change; } /** @@ -1115,13 +1224,40 @@ class kanbanTest return $object; } - public function updateCardTest($cardID) + /** + * Test update a card. + * + * @param int $cardID + * @param array $param + * @access public + * @return array + */ + public function updateCardTest($cardID, $param) { - $objects = $this->objectModel->updateCard($cardID); + global $tester; + $object = $tester->dao->select('`name`,`desc`,`assignedTo`,`begin`,`end`,`pri`,`estimate`, `progress`')->from(TABLE_KANBANCARD)->where('`id`')->eq($cardID)->fetch(); + $object->assignedTo = explode(',', $object->assignedTo); - if(dao::isError()) return dao::getError(); + foreach($object as $field => $value) + { + if(in_array($field, array_keys($param))) + { + $_POST[$field] = $param[$field]; + } + else + { + $_POST[$field] = $value; + } + } - return $objects; + $change = $this->objectModel->updateCard($cardID); + if($change == array()) $change = '没有数据更新'; + unset($_POST); + + + if(dao::isError()) return dao::getError()[0]; + + return $change; } /** @@ -1222,31 +1358,23 @@ class kanbanTest return $object; } - public function setHeaderActionsTest($kanban) - { - $objects = $this->objectModel->setHeaderActions($kanban); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function setSwitcherTest($kanban) - { - $objects = $this->objectModel->setSwitcher($kanban); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - + /** + * Test sort kanban group; + * + * @param int $region + * @param array $groups + * @access public + * @return string + */ public function sortGroupTest($region, $groups) { - $objects = $this->objectModel->sortGroup($region, $groups); + $this->objectModel->sortGroup($region, $groups); if(dao::isError()) return dao::getError(); - return $objects; + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_KANBANGROUP)->where('region')->eq($region)->orderBy('order_asc')->fetchAll('id'); + return implode(array_keys($objects), ','); } /** @@ -1272,22 +1400,22 @@ class kanbanTest return $object; } + /** + * Test update a card's color. + * + * @param int $cardID + * @param string $color + * @access public + * @return object + */ public function updateCardColorTest($cardID, $color) { - $objects = $this->objectModel->updateCardColor($cardID, $color); + $this->objectModel->updateCardColor($cardID, $color); if(dao::isError()) return dao::getError(); - return $objects; - } - - public function resetLaneOrderTest($executionID, $type, $groupBy) - { - $objects = $this->objectModel->resetLaneOrder($executionID, $type, $groupBy); - - if(dao::isError()) return dao::getError(); - - return $objects; + $object = $this->objectModel->getCardByID($cardID); + return $object; } /** @@ -1366,7 +1494,7 @@ class kanbanTest if(dao::isError()) return dao::getError(); global $tester; - $nodes = $tester->dao->select('id,id')->from(TABLE_KANBANCOLUMN)->where('`parent`')->eq($column->parent)->fetchPairs(); + $nodes = $tester->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('`parent`')->eq($column->parent)->andWhere('`id`')->ne($columnID)->fetchAll('id'); $objects = $tester->dao->select('*')->from(TABLE_KANBANCELL)->where('`column`')->in(array_keys($nodes))->fetchAll(); $cards = ''; @@ -1503,6 +1631,15 @@ class kanbanTest return $object; } + /** + * Test get object group list. + * + * @param int $executionID + * @param string $type + * @param string $groupBy + * @access public + * @return array + */ public function getObjectGroupTest($executionID, $type, $groupBy) { $objects = $this->objectModel->getObjectGroup($executionID, $type, $groupBy); @@ -1566,6 +1703,14 @@ class kanbanTest return count($objects); } + /** + * Test get Kanban cards menus by execution id. + * + * @param int $executionID + * @param string $objecType + * @access public + * @return int + */ public function getKanbanCardMenuTest($executionID, $objecType) { global $tester; diff --git a/test/class/my.class.php b/test/class/my.class.php new file mode 100644 index 0000000000..0a42cf82a3 --- /dev/null +++ b/test/class/my.class.php @@ -0,0 +1,85 @@ +objectModel = $tester->loadModel('my'); + } + + /** + * Function getProducts test by my + * + * @param string $type + * @access public + * @return object + */ + public function getProductsTest($type) + { + $objects = $this->objectModel->getProducts($type); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Function getDoingProjects test by my + * + * @access public + * @return object + */ + public function getDoingProjectsTest() + { + $objects = $this->objectModel->getDoingProjects(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Function getOverview test by my + * + * @access public + * @return object + */ + public function getOverviewTest() + { + $objects = $this->objectModel->getOverview(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Function getContribute test by my + * + * @access public + * @return object + */ + public function getContributeTest() + { + $objects = $this->objectModel->getContribute(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Function getActions test by my + * + * @access public + * @return array + */ + public function getActionsTest() + { + $objects = $this->objectModel->getActions(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/class/program.class.php b/test/class/program.class.php index c80d39ce51..de87cfb82b 100644 --- a/test/class/program.class.php +++ b/test/class/program.class.php @@ -12,7 +12,6 @@ class programTest { global $tester; - su('admin'); $this->program = $tester->loadModel('program'); } @@ -51,93 +50,6 @@ class programTest return $this->program->getStakeholdersByPrograms($programID); } - /** - * getBudgetLeft - * - * @param int mixed $programID - * @access public - * @return void - */ - public function getBudgetLeft($programID) - { - $program = $this->program->getById(1); - - return $this->program->getBudgetLeft($program); - } - - /** - * getBudgetUnitList - * - * @access public - * @return void - */ - public function getBudgetUnitList() - { - global $app; - $app->loadConfig('project'); - $app->loadLang('project'); - - return $this->program->getBudgetUnitList(); - } - - /** - * getById - * - * @param iont mixed $programID - * @access public - * @return void - */ - public function getById($programID) - { - if(empty($this->program->getById($programID))) - { - return array('code' => 'fail', 'message' => 'Not Found'); - } - else - { - return $this->program->getById($programID); - } - } - - /** - * getChildren - * - * @param int mixed $programID - * @access public - * @return void - */ - public function getChildren($programID) - { - $programInfo = $this->program->getChildren($programID); - if(empty($programInfo)) - { - return array('code' => 'fail' , 'message' => 'Not Found'); - } - else - { - return $programInfo; - } - } - - /** - * Test get pairs by list. - * - * @param string|array $programIDList - * @access public - * @return void - */ - public function getPairsByList($programIDList = '') - { - if(empty($this->program->getPairsByList($programIDList))) - { - return array('code' => '404', 'message' => 'Not Found'); - } - else - { - return $this->program->getPairsByList($programIDList); - } - } - /** * Test get list. * @@ -156,228 +68,6 @@ class programTest } - /** - * getParentPairs - * - * @access public - * @return void - */ - public function getParentPairs() - { - return $this->program->getParentPairs(); - } - - /** - * getParentPM - * - * @param array mixed $programIdList - * @access public - * @return void - */ - public function getParentPM($programIdList) - { - return $this->program->getParentPM($programIdList); - } - - /** - * getProductPairsByID - * - * @param int $programID - * @access public - * @return void - */ - 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'); - } - - /** - * getProductPairsByMod - * - * @param string $mode - * @access public - * @return void - */ - public function getProductPairsByMod($mode = 'assign') - { - return $this->program->getProductPairs(1, $mode, 'noclosed'); - } - - /** - * getProductPairsByStatus - * - * @param string $status - * @access public - * @return void - */ - public function getProductPairsByStatus($status = 'all') - { - return $this->program->getProductPairs(1, 'assign', $status); - } - - /** - * getProgressList - * - * @access public - * @return void - */ - public function getProgressList() - { - return $this->program->getProgressList(); - } - - /** - * getStatsByProgramID - * - * @param int $programID - * @access public - * @return void - */ - public function getStatsByProgramID($programID = 0) - { - return count($this->program->getProjectStats($programID)); - } - - /** - * getStatsByStatus - * - * @param string $browseType - * @access public - * @return void - */ - 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); - } - - /** - * getStatsByOrder - * - * @param string $orderBy - * @access public - * @return void - */ - public function getStatsByOrder($orderBy = 'id_desc') - { - $projects = $this->program->getProjectStats('0', 'all', '0', $orderBy); - - return checkOrder($projects, $orderBy); - } - - /** - * getStatsAddProgramTitle - * - * @param int $programTitle - * @access public - * @return void - */ - public function getStatsAddProgramTitle($programTitle = 0) - { - return $this->program->getProjectStats('0', 'all', '0', 'id_desc', '', $programTitle); - } - - /** - * getStatsByInvolved - * - * @param int $involved - * @param string $count - * @access public - * @return void - */ - 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; - } - - /** - * getByPrograms - * - * @param int $programIdList - * @access public - * @return void - */ - public function getByPrograms($programIdList = 0) - { - $stakeHolders = $this->program->getStakeholdersByPrograms($programIdList); - - return $stakeHolders; - } - - /** - * getByOrder - * - * @param string $orderBy - * @access public - * @return void - */ - public function getByOrder($orderBy = 'id_desc') - { - $stakeholders = $this->program->getStakeholders(2, $orderBy); - - return checkOrder($stakeholders, $orderBy); - } - - /** - * getTopPairs - * - * @param string $count - * @access public - * @return void - */ - public function getTopPairs($count = '') - { - if($count == 'count') return count($this->program->getTopPairs()); - return $this->program->getTopPairs(); - } - - /** - * getUnfinished - * - * @param mixed $programID - * @access public - * @return void - */ - public function getUnfinished($programID) - { - $program = $this->program->getById($programID); - - return $this->program->hasUnfinished($program); - } - - /** - * setTreePath - * - * @param mixed $programID - * @access public - * @return void - */ - public function setTreePath($programID) - { - $programPath = $this->program->setTreePath($programID); - if($programPath) - { - return $this->program->getById($programID); - } - else - { - return 0; - } - } - /** * update * @@ -388,75 +78,10 @@ class programTest */ public function update($programID, $data) { - global $app; - $_POST = $data; - $result = $this->program->update(10); + $this->program->update($programID); if(dao::isError()) return array('message' => dao::getError()); - $app->dbh->query("UPDATE " . TABLE_PROGRAM . " SET name = '" . $result[0]['old']. "' where id = '" . $programID . "'"); - return $result; + return $this->program->getByID($programID); } - - /** - * updateProgram - * - * @param mixed $programID - * @param int $status - * @access public - * @return void - */ - 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); - } - - /** - * Test process node method. - * - * @param int $programID - * @param int $parentID - * @param string $oldPath - * @param int $oldGrade - * @access public - * @return void - */ - public function processNode($programID, $parentID, $oldPath, $oldGrade) - { - $programs = $this->program->processNode($programID, $parentID, $oldPath, $oldGrade); - return $programs; - } - } -?> diff --git a/test/data/action.yaml b/test/data/action.yaml index ee30e86443..6156236d7e 100644 --- a/test/data/action.yaml +++ b/test/data/action.yaml @@ -47,12 +47,12 @@ fields: format: "" - field: date note: "日期" - from: common.date.v1.yaml - use: dateA + range: "(-1M)-(w):1D" + type: timestamp prefix: "" postfix: "" loop: 0 - format: "" + format: "YYYY-MM-DD hh:mm:ss" - field: comment note: "备注" range: 1-100000 diff --git a/test/data/execution.yaml b/test/data/execution.yaml index 0a2ba25a18..94485096bb 100644 --- a/test/data/execution.yaml +++ b/test/data/execution.yaml @@ -17,6 +17,8 @@ fields: range: [] - field: type range: sprint{30},stage{30},kanban{30} + - field: budget + range: 800000-1:100 - field: status range: wait,doing - field: percent diff --git a/test/data/executionson.yaml b/test/data/executionson.yaml index 39a5e92b83..3d0a0abf8b 100644 --- a/test/data/executionson.yaml +++ b/test/data/executionson.yaml @@ -17,6 +17,8 @@ fields: range: [] - field: type range: stage + - field: budget + range: 700000-1:100 - field: status range: wait,doing - field: percent diff --git a/test/data/program.yaml b/test/data/program.yaml index ee09f51582..354ef3f815 100644 --- a/test/data/program.yaml +++ b/test/data/program.yaml @@ -17,6 +17,8 @@ fields: range: 1-10000 - field: type range: program + - field: budget + range: 1000000-1:100 - field: status range: wait - field: parent @@ -42,6 +44,18 @@ fields: prefix: "项目集描述" - field: acl range: open{4},private{4} + - field: PO + range: 1-10 + prefix: "po" + - field: PM + range: 1-10 + prefix: "pm" + - field: QD + range: 1-10 + prefix: "test" + - field: RD + range: 1-10 + prefix: "dev" - field: openedVersion range: "16.5" - field: whitelist diff --git a/test/data/project.yaml b/test/data/project.yaml index b3febc956e..1bfd668804 100644 --- a/test/data/project.yaml +++ b/test/data/project.yaml @@ -22,7 +22,7 @@ fields: - field: lifetime range: - field: budget - range: 0 + range: 900000-1:100 - field: budgetUnit range: CNY,USD - field: attribute diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index e22b9f38e6..ad10f9ab65 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -50,6 +50,7 @@ class Processor $this->initBug(); $this->initTest(); $this->initTodo(); + $this->initBassicSql(); $this->dao->commit(); } @@ -285,6 +286,20 @@ class Processor { } + /** + * init BassicSql. + * + * @access private + * @return void + */ + private function initBassicSql() + { + global $app; + $sqlRoot = $app->getAppRoot(); + $this->dao->exec(file_get_contents($sqlRoot . '/data/zt_lang.sql')); + $this->dao->exec(file_get_contents($sqlRoot . '/data/zt_cron.sql')); + } + /** * Init Stakeholder. * @@ -417,5 +432,15 @@ class Processor $this->dao->query("update zt_kanbancell set `cards` = ',246,' where id = 428"); $this->dao->query("update zt_kanbancell set `cards` = ',184,185,186,' where id = 439"); $this->dao->query("update zt_kanbancell set `cards` = ',62,' where id = 448"); + $this->dao->query("update zt_kanbancell set `cards` = ',247,' where id = 458"); + $this->dao->query("update zt_kanbancell set `cards` = ',187,188,189,' where id = 469"); + $this->dao->query("update zt_kanbancell set `cards` = ',63,' where id = 477"); + $this->dao->query("update zt_kanbancell set `cards` = ',248,' where id = 485"); + $this->dao->query("update zt_kanbancell set `cards` = ',190,191,192,' where id = 496"); + $this->dao->query("update zt_kanbancell set `cards` = ',64,' where id = 504"); + $this->dao->query("update zt_kanbancolumn set `parent` = '-1' where id = 202"); + $this->dao->query("update zt_kanbancolumn set `parent` = '202' where id in ('203','204')"); + $this->dao->query("update zt_kanbancolumn set `parent` = '-1' where id = 206"); + $this->dao->query("update zt_kanbancolumn set `parent` = '206' where id in ('207','208')"); } } diff --git a/test/data/zt_cron.sql b/test/data/zt_cron.sql new file mode 100644 index 0000000000..7d85f257b3 --- /dev/null +++ b/test/data/zt_cron.sql @@ -0,0 +1,22 @@ +truncate `zt_cron`; +INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES +('*', '*', '*', '*', '*', '', '监控定时任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('30', '23', '*', '*', '*', 'moduleName=execution&methodName=computeburn', '更新燃尽图', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('0', '8', '*', '*', '*', 'moduleName=report&methodName=remind', '每日任务提醒', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=svn&methodName=run', '同步SVN', 'zentao', 1, 'stop', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=git&methodName=run', '同步GIT', 'zentao', 1, 'stop', '0000-00-00 00:00:00'), +('30', '0', '*', '*', '*', 'moduleName=backup&methodName=backup', '备份数据和附件', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=mail&methodName=asyncSend', '异步发信', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=webhook&methodName=asyncSend', '异步发送Webhook', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=admin&methodName=deleteLog', '删除过期日志', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('1', '1', '*', '*', '*', 'moduleName=todo&methodName=createCycle', '生成周期性待办', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('1', '0', '*', '*', '*', 'moduleName=ci&methodName=initQueue', '创建周期性任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkCompileStatus', '同步DevOps构建任务状态', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=exec', '执行DevOps构建任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), +('*/5', '*', '*', '*', '*', 'moduleName=mr&methodName=syncMR', '定时同步GitLab合并数据到禅道数据库', 'zentao', 1, 'normal', '0000-00-00 00:00:00'); +INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('30', '23', '*', '*', '*', 'moduleName=execution&methodName=computeTaskEffort', '计算任务剩余工时', 'zentao', '1', 'normal', '0000-00-00 00:00:00'); +INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('30', '7', '*', '*', '*', 'moduleName=effort&methodName=remindNotRecord', '提醒录入日志', 'zentao', '1', 'stop', '0000-00-00 00:00:00'); +REPLACE INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES +('1','0','*','*','*','moduleName=weekly&methodName=computeWeekly','更新项目周报','system',0,'normal','2020-08-27 10:07:53'), +('1','0','*','*','*','moduleName=measurement&methodName=initCrontabQueue','初始化度量队列','zentao',0,'normal','2020-07-07 14:51:48'), +('*/5','*','*','*','*','moduleName=measurement&methodName=execCrontabQueue','执行度量队列','zentao',0,'running','2020-07-10 13:10:58'); diff --git a/test/data/zt_lang.sql b/test/data/zt_lang.sql new file mode 100644 index 0000000000..6e4246d6f1 --- /dev/null +++ b/test/data/zt_lang.sql @@ -0,0 +1,14 @@ +truncate `zt_lang`; +REPLACE INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) VALUES +('zh-cn', 'custom', 'URSRList', '1', '{\"SRName\":\"\\u8f6f\\u4ef6\\u9700\\u6c42\",\"URName\":\"\\u7528\\u6237\\u9700\\u6c42\"}', '1'),('zh-cn', 'custom', 'URSRList', '2', '{\"SRName\":\"\\u7814\\u53d1\\u9700\\u6c42\",\"URName\":\"\\u7528\\u6237\\u9700\\u6c42\"}', '1'), +('zh-cn', 'custom', 'URSRList', '3', '{\"SRName\":\"\\u8f6f\\u9700\",\"URName\":\"\\u7528\\u9700\"}', '1'),('zh-cn', 'custom', 'URSRList', '4', '{\"SRName\":\"\\u6545\\u4e8b\",\"URName\":\"\\u53f2\\u8bd7\"}', '1'), +('zh-cn', 'custom', 'URSRList', '5', '{\"SRName\":\"\\u9700\\u6c42\",\"URName\":\"\\u7528\\u6237\\u9700\\u6c42\"}', '1'), +('en', 'custom', 'URSRList', '1', '{\"SRName\":\"Story\",\"URName\":\"Epic\"}', '0'), +('en', 'custom', 'URSRList', '2', '{\"SRName\":\"Software Requirement\",\"URName\":\"User Requirement\"}', '0'), +('all','stage','typeList','request','需求', '1'), +('all','stage','typeList','design','设计', '1'), +('all','stage','typeList','dev','开发', '1'), +('all','stage','typeList','qa','测试', '1'), +('all','stage','typeList','release','发布', '1'), +('all','stage','typeList','review','总结评审','1'), +('all','stage','typeList','other','其他','1'); diff --git a/test/model/kanban/getcardgroupbyexecution.php b/test/model/kanban/getcardgroupbyexecution.php index e3ea790afe..affbfd3a54 100755 --- a/test/model/kanban/getcardgroupbyexecution.php +++ b/test/model/kanban/getcardgroupbyexecution.php @@ -24,6 +24,6 @@ r($kanban->getCardGroupByExecutionTest($executionIDList[1])) r($kanban->getCardGroupByExecutionTest($executionIDList[1], $browseTypeList[0])) && p() && e('1'); // 测试查询execution162的task卡片 r($kanban->getCardGroupByExecutionTest($executionIDList[1], $browseTypeList[1])) && p() && e('3'); // 测试查询execution162的bug卡片 r($kanban->getCardGroupByExecutionTest($executionIDList[1], $browseTypeList[2])) && p() && e('1'); // 测试查询execution162的story卡片 -r($kanban->getCardGroupByExecutionTest($executionIDList[2])) && p() && e('0'); // 测试查询execution163的卡片 -r($kanban->getCardGroupByExecutionTest($executionIDList[3])) && p() && e('0'); // 测试查询execution164的卡片 +r($kanban->getCardGroupByExecutionTest($executionIDList[2])) && p() && e('4'); // 测试查询execution163的卡片 +r($kanban->getCardGroupByExecutionTest($executionIDList[3])) && p() && e('4'); // 测试查询execution164的卡片 r($kanban->getCardGroupByExecutionTest($executionIDList[4])) && p() && e('0'); // 测试查询execution165的卡片 diff --git a/test/model/kanban/getrdkanban.php b/test/model/kanban/getrdkanban.php index feffb0a8ae..44283c43b7 100755 --- a/test/model/kanban/getrdkanban.php +++ b/test/model/kanban/getrdkanban.php @@ -23,9 +23,9 @@ r($kanban->getRDKanbanTest($executionIDList[0], $browseTypeList[0], $regionIDLis r($kanban->getRDKanbanTest($executionIDList[0], $browseTypeList[0], $regionIDList[2])) && p() && e('columns:0, lanes:0, cards:0'); // 获取执行161 all region 102的执行看板 r($kanban->getRDKanbanTest($executionIDList[1])) && p() && e('columns:27, lanes:3, cards:5'); // 获取执行162的执行看板 r($kanban->getRDKanbanTest($executionIDList[1], $browseTypeList[1], $regionIDList[2])) && p() && e('columns:11, lanes:1, cards:2'); // 获取执行162 story region 102的执行看板 -r($kanban->getRDKanbanTest($executionIDList[2])) && p() && e('columns:27, lanes:3, cards:0'); // 获取执行163的执行看板 +r($kanban->getRDKanbanTest($executionIDList[2])) && p() && e('columns:27, lanes:3, cards:4'); // 获取执行163的执行看板 r($kanban->getRDKanbanTest($executionIDList[2], $browseTypeList[2], $regionIDList[3])) && p() && e('columns:7, lanes:1, cards:4'); // 获取执行163 task region 103的执行看板 -r($kanban->getRDKanbanTest($executionIDList[3])) && p() && e('columns:27, lanes:3, cards:0'); // 获取执行164的执行看板 +r($kanban->getRDKanbanTest($executionIDList[3])) && p() && e('columns:27, lanes:3, cards:4'); // 获取执行164的执行看板 r($kanban->getRDKanbanTest($executionIDList[3], $browseTypeList[3], $regionIDList[4])) && p() && e('columns:9, lanes:1, cards:3'); // 获取执行164 bug region 104的执行看板 r($kanban->getRDKanbanTest($executionIDList[4])) && p() && e('columns:27, lanes:3, cards:0'); // 获取执行165的执行看板 r($kanban->getRDKanbanTest($executionIDList[4], $browseTypeList[1], $regionIDList[5])) && p() && e('columns:11, lanes:1, cards:2'); // 获取执行165 story region 105的执行看板 diff --git a/test/model/kanban/processcards.php b/test/model/kanban/processcards.php new file mode 100755 index 0000000000..4dfcaa166e --- /dev/null +++ b/test/model/kanban/processcards.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +processCards(); +cid=1 +pid=1 + +*/ + +$columnIDList = array('203', '204', '207', '208'); + +$kanban = new kanbanTest(); + +r($kanban->processCardsTest($columnIDList[0])) && p() && e('204:,407,408,807,405,406,805,'); // 计算删除列203后的卡片 +r($kanban->processCardsTest($columnIDList[1])) && p() && e('203:,405,406,805,407,408,807,405,406,805,'); // 计算删除列204后的卡片 +r($kanban->processCardsTest($columnIDList[2])) && p() && e('208:,415,416,815,413,414,813,'); // 计算删除列207后的卡片 +r($kanban->processCardsTest($columnIDList[3])) && p() && e('207:,413,414,813,415,416,815,413,414,813,'); // 计算删除列208后的卡片 +system("./ztest init"); diff --git a/test/model/kanban/sortgroup.php b/test/model/kanban/sortgroup.php new file mode 100755 index 0000000000..8305c9427c --- /dev/null +++ b/test/model/kanban/sortgroup.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +sortGroup(); +cid=1 +pid=1 + +*/ + +$regionIDList = array('101', '102', '103', '104', '105'); +$groupIDList = array(array('103', '101', '102'), array('105', '106', '104'), array('107', '109', '108'), array('112', '111', '110'), array('114', '113', '115')); + +$kanban = new kanbanTest(); + +r($kanban->sortGroupTest($regionIDList[0], $groupIDList[0])) && p() && e('103,101,102'); // 测试区域101 泳道组101 102 103排序 +r($kanban->sortGroupTest($regionIDList[1], $groupIDList[1])) && p() && e('105,106,104'); // 测试区域102 泳道组104 105 106排序 +r($kanban->sortGroupTest($regionIDList[2], $groupIDList[2])) && p() && e('107,109,108'); // 测试区域103 泳道组107 108 109排序 +r($kanban->sortGroupTest($regionIDList[3], $groupIDList[3])) && p() && e('112,111,110'); // 测试区域104 泳道组110 111 112排序 +r($kanban->sortGroupTest($regionIDList[4], $groupIDList[4])) && p() && e('114,113,115'); // 测试区域105 泳道组113 114 115排序 diff --git a/test/model/kanban/splitcolumn.php b/test/model/kanban/splitcolumn.php new file mode 100755 index 0000000000..1d275aad08 --- /dev/null +++ b/test/model/kanban/splitcolumn.php @@ -0,0 +1,46 @@ +#!/usr/bin/env php +splitColumn(); +cid=1 +pid=1 + +*/ + +$columnIDList = array('1', '2', '3', '4'); + +$name = array('1' => '拆分的子列1', '2' => '拆分的子列2'); +$color = array('1' => '#333', '2' => '#333'); +$WIPCount = array('1' => '111'); +$noLimit = array('2' => '-1'); +$splits1 = array('name' => $name, 'color' => $color, 'WIPCount' => $WIPCount, 'noLimit' => $noLimit); + +$name = array('1' => '拆分的子列3', '2' => '拆分的子列4'); +$WIPCount = array('1' => '111', '2' => '111'); +$splits2 = array('name' => $name, 'color' => $color, 'WIPCount' => $WIPCount); + +$name = array('1' => '拆分的子列5', '2' => '拆分的子列6'); +$noLimit = array('1' => '-1', '2' => '-1'); +$splits3 = array('name' => $name, 'color' => $color, 'noLimit' => $noLimit); + +$WIPCount = array('1' => 'a', '2' => '0'); +$splits4 = array('name' => $name, 'color' => $color, 'WIPCount' => $WIPCount); + +$name = array('1' => '', '2' => ''); +$splits5 = array('name' => $name, 'color' => $color, 'noLimit' => $noLimit); + + + +$kanban = new kanbanTest(); + +r($kanban->splitColumnTest($columnIDList[0], $splits1)) && p() && e('2'); // 测试拆分列1 +r($kanban->splitColumnTest($columnIDList[1], $splits2)) && p() && e('2'); // 测试拆分列2 +r($kanban->splitColumnTest($columnIDList[2], $splits3)) && p() && e('2'); // 测试拆分列3 +r($kanban->splitColumnTest($columnIDList[3], $splits4)) && p('limit') && e('在制品数量必须是正整数。'); // 测试拆分列4 +r($kanban->splitColumnTest($columnIDList[3], $splits5)) && p('name') && e('『看板列名称』不能为空。'); // 测试拆分列4 +system("./ztest init"); diff --git a/test/model/kanban/update.php b/test/model/kanban/update.php new file mode 100755 index 0000000000..43ebe89d41 --- /dev/null +++ b/test/model/kanban/update.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$kanbanIDList = array('1', '2', '3', '4', '5'); + +$names = array('修改名字', '', ' '); +$space = array('2', ''); +$desc = '修改注释'; +$owner = 'user4'; +$team = array('user5', 'po17', 'user3'); + +$kanban = new kanbanTest(); + +r($kanban->updateTest($kanbanIDList[0], array('name' => $names[0]))) && p('0:field,old,new') && e('name,通用看板1,修改名字'); // 测试修改看板名称 +r($kanban->updateTest($kanbanIDList[1], array('space' => $space[0]))) && p('0:field,old,new') && e('space,1,2'); // 测试修改看板空间 +r($kanban->updateTest($kanbanIDList[2], array('desc' => $desc))) && p('0:field,old,new') && e('desc,看板详情,修改注释'); // 测试修改看板备注 +r($kanban->updateTest($kanbanIDList[3], array('owner' => $owner))) && p('0:field,old,new') && e('owner,po16,user4'); // 测试修改看板负责人 +r($kanban->updateTest($kanbanIDList[4], array('team' => $team))) && p('0:field,old,new') && e('team,,user5,po17,,user5,po17,user3'); // 测试修改看板团队成员 +r($kanban->updateTest($kanbanIDList[0], array('name' => $names[0]))) && p() && e('没有数据更新'); // 测试重复修改看板名称 +r($kanban->updateTest($kanbanIDList[0], array('name' => $names[1]))) && p('name:0') && e('『看板名称』不能为空。'); // 测试修改看板名称为空 +r($kanban->updateTest($kanbanIDList[0], array('name' => $names[2]))) && p('name:0') && e('『看板名称』不能为空。'); // 测试修改看板名称为空格 +r($kanban->updateTest($kanbanIDList[0], array('space' => $space[1]))) && p('space:0') && e('『所属空间』不能为空。'); // 测试修改看板空间为空 +system("./ztest init"); diff --git a/test/model/kanban/updatecard.php b/test/model/kanban/updatecard.php new file mode 100755 index 0000000000..241305b11a --- /dev/null +++ b/test/model/kanban/updatecard.php @@ -0,0 +1,49 @@ +#!/usr/bin/env php +updateCard(); +cid=1 +pid=1 + +*/ + +$cardIDList = array('1', '2', '3', '4', '5'); + +$name = array('修改名字', '', ' '); +$desc = '修改注释'; +$assignedTo = array('user5', 'po17', 'user3'); +$begin = '2022-03-30'; +$end = '2022-04-01'; +$pri = '1'; +$estimate = array('3' , '0', '', '-1'); +$progress = array('0', '50', '100', '-1', '101'); + +$param1 = array('name' => $name[0], 'desc' => $desc, 'estimate' => $estimate[0]); +$param2 = array('begin' => $begin, 'end' => $end, 'progress' => $progress[0]); +$param3 = array('assignedTo' => $assignedTo, 'estimate' => $estimate[1], 'progress' => $progress[1]); +$param4 = array('estimate' => $estimate[2], 'progress' => $progress[2]); +$param5 = array('pri' => $pri); + +$end = '2022-01-01'; +$param6 = array('begin' => $begin, 'end' => $end); +$param7 = array('estimate' => $estimate[3]); +$param8 = array('progress' => $progress[3]); +$param9 = array('progress' => $progress[4]); + +$kanban = new kanbanTest(); + +r($kanban->updateCardTest($cardIDList[0], $param1)) && p('0:field,old,new;1:field,old,new;2:field,old,new') && e('name,卡片1,修改名字;desc,,修改注释;estimate,0,3'); // 测试修改卡片1 +r($kanban->updateCardTest($cardIDList[1], $param2)) && p('0:field,new;1:field,new;2:field,old,new') && e('begin,2022-03-30;end,2022-04-01;progress,50,0'); // 测试修改卡片2 +r($kanban->updateCardTest($cardIDList[2], $param3)) && p('0:field,old,new;1:field,old,new;2:field,old,new') && e('assignedTo,admin,user5,po17,user3;progress,100,50;status,done,doing'); // 测试修改卡片3 +r($kanban->updateCardTest($cardIDList[3], $param4)) && p('0:field,old,new;1:field,old,new') && e('progress,0,100;status,doing,done'); // 测试修改卡片4 +r($kanban->updateCardTest($cardIDList[4], $param5)) && p('0:field,old,new') && e('pri,3,1'); // 测试修改卡片5 +r($kanban->updateCardTest($cardIDList[0], $param6)) && p() && e('"截止日期"不能小于"预计开始"!'); // 测试修改卡片开始小于结束日期 +r($kanban->updateCardTest($cardIDList[0], $param7)) && p() && e('预计不能为负数!'); // 测试修改卡片预计小于0 +r($kanban->updateCardTest($cardIDList[0], $param8)) && p() && e('请输入正确的进度'); // 测试修改卡片进度小于0 +r($kanban->updateCardTest($cardIDList[0], $param9)) && p() && e('请输入正确的进度'); // 测试修改卡片进度大于100 +system("./ztest init"); diff --git a/test/model/kanban/updatecardcolor.php b/test/model/kanban/updatecardcolor.php new file mode 100755 index 0000000000..aca011c327 --- /dev/null +++ b/test/model/kanban/updatecardcolor.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +updateCardColor(); +cid=1 +pid=1 + +*/ + +$cardIDList = array('1', '2', '3', '4', '5'); +$colorList = array('b10b0b', 'cfa227', '2a5f29'); + +$kanban = new kanbanTest(); + +r($kanban->updateCardColorTest($cardIDList[0], $colorList[0])) && p('id,name,color') && e('1,卡片1,#b10b0b'); // 更新卡片1的颜色 +r($kanban->updateCardColorTest($cardIDList[1], $colorList[1])) && p('id,name,color') && e('2,卡片2,#cfa227'); // 更新卡片2的颜色 +r($kanban->updateCardColorTest($cardIDList[2], $colorList[2])) && p('id,name,color') && e('3,卡片3,#2a5f29'); // 更新卡片3的颜色 +r($kanban->updateCardColorTest($cardIDList[3], $colorList[0])) && p('id,name,color') && e('4,卡片4,#b10b0b'); // 更新卡片4的颜色 +r($kanban->updateCardColorTest($cardIDList[4], $colorList[1])) && p('id,name,color') && e('5,卡片5,#cfa227'); // 更新卡片5的颜色 diff --git a/test/model/kanban/updatelane.php b/test/model/kanban/updatelane.php new file mode 100755 index 0000000000..6cc974983d --- /dev/null +++ b/test/model/kanban/updatelane.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +updateLane(); +cid=1 +pid=1 + +*/ + +$executionID = array('101', '102', '103'); +$laneType = array('story', 'bug', 'task'); + +$kanban = new kanbanTest(); + +r($kanban->updateLaneTest($executionID[0], $laneType[0])) && p() && e('0'); // 测试更新执行101的story泳道 +r($kanban->updateLaneTest($executionID[0], $laneType[1])) && p() && e(',1,3,301,2,'); // 测试更新执行101的bug泳道 +r($kanban->updateLaneTest($executionID[0], $laneType[2])) && p() && e(',1,901,907,902,908,903,909,904,910,905,906,'); // 测试更新执行101的task泳道 +r($kanban->updateLaneTest($executionID[1], $laneType[0])) && p() && e(',6,8,'); // 测试更新执行102的story泳道 +r($kanban->updateLaneTest($executionID[1], $laneType[1])) && p() && e(',5,302,4,6,'); // 测试更新执行102的bug泳道 +r($kanban->updateLaneTest($executionID[1], $laneType[2])) && p() && e(',2,604,605,606,'); // 测试更新执行102的task泳道 +r($kanban->updateLaneTest($executionID[2], $laneType[0])) && p() && e(',10,12,'); // 测试更新执行103的story泳道 +r($kanban->updateLaneTest($executionID[2], $laneType[1])) && p() && e(',7,9,303,8,'); // 测试更新执行103的bug泳道 +r($kanban->updateLaneTest($executionID[2], $laneType[2])) && p() && e(',607,608,3,609,'); // 测试更新执行103的task泳道 diff --git a/test/model/kanban/updatelanecolumn.php b/test/model/kanban/updatelanecolumn.php new file mode 100755 index 0000000000..4dbfdc0124 --- /dev/null +++ b/test/model/kanban/updatelanecolumn.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +updateLaneColumn(); +cid=1 +pid=1 + +*/ +$columnIDList = array('1', '2', '3', '4', '5'); +$nameList = array('测试修改列名1', '测试修改列名2', '测试修改列名3', '', ' '); +$colorList = array('#2b519c', '#e48610', '#d2313d', '#2a9f23', '#777'); + +$kanban = new kanbanTest(); + +r($kanban->updateLaneColumnTest($columnIDList[0], $nameList[0], $colorList[0])) && p('0:field,new,old;1:field,new,old') && e('name,测试修改列名1,未开始;color,#2b519c,#333'); // 测试修改列1信息 +r($kanban->updateLaneColumnTest($columnIDList[1], $nameList[1], $colorList[1])) && p('0:field,new,old;1:field,new,old') && e('name,测试修改列名2,进行中;color,#e48610,#333'); // 测试修改列2信息 +r($kanban->updateLaneColumnTest($columnIDList[2], $nameList[2], $colorList[2])) && p('0:field,new,old;1:field,new,old') && e('name,测试修改列名3,已完成;color,#d2313d,#333'); // 测试修改列3信息 +r($kanban->updateLaneColumnTest($columnIDList[3], $nameList[3], $colorList[3])) && p('name:0') && e('『看板列名称』不能为空。'); // 测试修改列4信息 +r($kanban->updateLaneColumnTest($columnIDList[4], $nameList[4], $colorList[4])) && p('name:0') && e('『看板列名称』不能为空。'); // 测试修改列5信息 diff --git a/test/model/kanban/updateregion.php b/test/model/kanban/updateregion.php new file mode 100755 index 0000000000..6a9824f16e --- /dev/null +++ b/test/model/kanban/updateregion.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +updateRegion(); +cid=1 +pid=1 + +*/ + +$regionIDList = array('1', '2', '3', '4', '5'); +$nameList = array('测试修改区域名称1', '测试修改区域名称2', '测试修改区域名称3', '', ' '); + +$kanban = new kanbanTest(); + +r($kanban->updateRegionTest($regionIDList[0], $nameList[0])) && p('0:field,old,new') && e('name,默认区域,测试修改区域名称1'); // 测试修改区域1的信息 +r($kanban->updateRegionTest($regionIDList[1], $nameList[1])) && p('0:field,old,new') && e('name,默认区域,测试修改区域名称2'); // 测试修改区域2的信息 +r($kanban->updateRegionTest($regionIDList[2], $nameList[2])) && p('0:field,old,new') && e('name,默认区域,测试修改区域名称3'); // 测试修改区域3的信息 +r($kanban->updateRegionTest($regionIDList[3], $nameList[3])) && p('name:0') && e('『区域名称』不能为空。'); // 测试修改区域4的信息 +r($kanban->updateRegionTest($regionIDList[4], $nameList[4])) && p('name:0') && e('『区域名称』不能为空。'); // 测试修改区域5的信息 diff --git a/test/model/kanban/updatespace.php b/test/model/kanban/updatespace.php new file mode 100755 index 0000000000..8215d0c4bb --- /dev/null +++ b/test/model/kanban/updatespace.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +updateSpace(); +cid=1 +pid=1 + +*/ + +$spaceIDList = array('1', '2', '3', '4', '5'); +$typeList = array('cooperation', 'private', 'public'); +$nameList = array('测试修改名称1', '测试修改名称2', '测试修改名称3', '测试修改名称4', '', ' '); +$ownerList = array('user3', ''); +$whitelist = array(',user4,po16,user3,'); +$team = array(',user5,po17,user3,'); +$desc = '修改备注'; + +$param1 = array('name' => $nameList[0], 'owner' => $ownerList[0]); +$param2 = array('name' => $nameList[1], 'whitelist' => $whitelist); +$param3 = array('name' => $nameList[2], 'team' => $team); +$param4 = array('name' => $nameList[3], 'desc' => $desc); +$param5 = array('name' => $nameList[4]); +$param6 = array('name' => $nameList[5]); +$param7 = array('owner' => $ownerList[1]); + +$kanban = new kanbanTest(); + +r($kanban->updateSpaceTest($spaceIDList[0], $typeList[0], $param1)) && p('0:field,old,new;1:field,old,new') && e('name,协作空间1,测试修改名称1;owner,po15,user3'); // 测试修改空间1 +r($kanban->updateSpaceTest($spaceIDList[1], $typeList[1], $param2)) && p('0:field,old,new;1:field,old,new') && e('name,私有空间2,测试修改名称2;whitelist,,user4,po16,,,user4,po16,user3,'); // 测试修改空间2 +r($kanban->updateSpaceTest($spaceIDList[2], $typeList[2], $param3)) && p('0:field,old,new;1:field,old,new') && e('name,公共空间3,测试修改名称3;team,,user5,po17,,,user5,po17,user3,'); // 测试修改空间3 +r($kanban->updateSpaceTest($spaceIDList[3], $typeList[0], $param4)) && p('0:field,old,new;1:field,old,new') && e('name,协作空间4,测试修改名称4;desc,,修改备注'); // 测试修改空间4 +r($kanban->updateSpaceTest($spaceIDList[3], $typeList[0], $param4)) && p() && e('没有数据更新'); // 测试重复修改空间4 +r($kanban->updateSpaceTest($spaceIDList[4], $typeList[1], $param5)) && p('name:0') && e('『空间名称』不能为空。'); // 测试修改空间5 不填写名称 +r($kanban->updateSpaceTest($spaceIDList[4], $typeList[1], $param6)) && p('name:0') && e('『空间名称』不能为空。'); // 测试修改空间5 名称为空格 +r($kanban->updateSpaceTest($spaceIDList[4], $typeList[1], $param7)) && p('owner:0') && e('『负责人』不能为空。'); // 测试修改空间5 不填写负责人 +system("./ztest init"); diff --git a/test/model/my/getactions.php b/test/model/my/getactions.php new file mode 100755 index 0000000000..24979d4067 --- /dev/null +++ b/test/model/my/getactions.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getActions(); +cid=1 +pid=1 + +正常查询action >> 32,,32,,这是一个系统日志测试备注32 +正常查询action统计 >> 5 + +*/ + +$my = new myTest(); + +r($my->getActionsTest()) && p('0:id,product,comment') && e('32,,32,,这是一个系统日志测试备注32');// 正常查询action +r(count($my->getActionsTest())) && p() && e('5'); // 正常查询action统计 \ No newline at end of file diff --git a/test/model/my/getcontribute.php b/test/model/my/getcontribute.php new file mode 100755 index 0000000000..5b3d727613 --- /dev/null +++ b/test/model/my/getcontribute.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +getContribute(); +cid=1 +pid=1 + +myTaskTotal数据获取 >> 0 +myStoryTotal数据获取 >> 0 +myBugTotal数据获取 >> 85 +docCreatedTotal数据获取 >> 900 +ownerProductTotal数据获取 >> 0 +involvedProjectTotal数据获取 >> 1 + +*/ + +$my = new myTest(); + +$myTaskTotal = $my->getContributeTest()->myTaskTotal; +$myStoryTotal = $my->getContributeTest()->myStoryTotal; +$myBugTotal = $my->getContributeTest()->myBugTotal; +$docCreatedTotal = $my->getContributeTest()->docCreatedTotal; +$ownerProductTotal = $my->getContributeTest()->ownerProductTotal; +$involvedProjectTotal = $my->getContributeTest()->involvedProjectTotal; + +r($myTaskTotal) && p() && e('0'); //myTaskTotal数据获取 +r($myStoryTotal) && p() && e('0'); //myStoryTotal数据获取 +r($myBugTotal) && p() && e('85'); //myBugTotal数据获取 +r($docCreatedTotal) && p() && e('900');//docCreatedTotal数据获取 +r($ownerProductTotal) && p() && e('0'); //ownerProductTotal数据获取 +r($involvedProjectTotal) && p() && e('1'); //involvedProjectTotal数据获取 \ No newline at end of file diff --git a/test/model/my/getdoingprojects.php b/test/model/my/getdoingprojects.php new file mode 100755 index 0000000000..58b177e372 --- /dev/null +++ b/test/model/my/getdoingprojects.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getDoingProjects(); +cid=1 +pid=1 + +获取doingcount数据 >> 5 +获取doing状态的项目 >> 项目86,doing +获取doing状态的项目统计 >> 5 + +*/ + +$my = new myTest(); + +$doingCount = $my->getDoingProjectsTest()->doingCount; +$projects = $my->getDoingProjectsTest()->projects; + +r($doingCount) && p() && e('5'); //获取doingcount数据 +r($projects) && p('0:name,status') && e('项目86,doing');//获取doing状态的项目 +r(count($projects)) && p() && e('5'); //获取doing状态的项目统计 \ No newline at end of file diff --git a/test/model/my/getoverview.php b/test/model/my/getoverview.php new file mode 100755 index 0000000000..7f671e60bd --- /dev/null +++ b/test/model/my/getoverview.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getOverview(); +cid=1 +pid=1 + +projectTotal数据获取 >> 110 +allConsumed数据获取 >> 6750 +thisYearConsumed数据获取 >> 0 + +*/ + +$my = new myTest(); + +$projectTotal = $my->getOverviewTest()->projectTotal; +$allConsumed = $my->getOverviewTest()->allConsumed; +$thisYearConsumed = $my->getOverviewTest()->thisYearConsumed; + +r($projectTotal) && p() && e('110'); //projectTotal数据获取 +r($allConsumed) && p() && e('6750');//allConsumed数据获取 +r($thisYearConsumed) && p() && e('0'); //thisYearConsumed数据获取 \ No newline at end of file diff --git a/test/model/my/getproducts.php b/test/model/my/getproducts.php new file mode 100755 index 0000000000..028b60ccd1 --- /dev/null +++ b/test/model/my/getproducts.php @@ -0,0 +1,42 @@ +#!/usr/bin/env php +getProducts(); +cid=1 +pid=1 + +undone产品allCount查询 >> 80 +undone产品unclosedCount查询 >> 80 +undone产品查询统计 >> 5 +ownbyme产品allCount查询 >> 0 +ownbyme产品unclosedCount查询 >> 0 +ownbyme产品查询 >> 0 +ownbyme产品查询统计 >> 0 +随意输入type产品数量查询 >> 5 +不输入type产品数量查询 >> 5 + +*/ + +$typeList = array('undone', 'ownbyme', 'all'); + +$my = new myTest(); + +$undoneProducts = $my->getProductsTest($typeList[0]); +$ownbymeProducts = $my->getProductsTest($typeList[1]); +$allProducts = $my->getProductsTest($typeList[2]); +$noType = $my->getProductsTest(''); + +r($undoneProducts->allCount) && p() && e('80'); //undone产品allCount查询 +r($undoneProducts->unclosedCount) && p() && e('80'); //undone产品unclosedCount查询 +r(count($undoneProducts->products)) && p() && e('5'); //undone产品查询统计 +r($ownbymeProducts->allCount) && p() && e('0'); //ownbyme产品allCount查询 +r($ownbymeProducts->unclosedCount) && p() && e('0'); //ownbyme产品unclosedCount查询 +r($ownbymeProducts->products) && p() && e('0'); //ownbyme产品查询 +r(count($ownbymeProducts->products)) && p() && e('0'); //ownbyme产品查询统计 +r(count($allProducts->products)) && p() && e('5'); //随意输入type产品数量查询 +r(count($noType->products)) && p() && e('5'); //不输入type产品数量查询 \ No newline at end of file diff --git a/test/model/program/create.php b/test/model/program/create.php index f6a8015851..2482bf3a23 100755 --- a/test/model/program/create.php +++ b/test/model/program/create.php @@ -2,6 +2,7 @@ > dev2;dev1 */ -$Stakeholder = new Program('admin'); -$t_Stakeholder = array('1'); +global $tester; +$tester->loadModel('program'); -r($Stakeholder->createStakeholder($t_Stakeholder[0])) && p('0:account;1:account') && e('dev2;dev1'); // 创建id=1的项目集的干系人dev1,dev2并查看。 -system("./ztest init"); \ No newline at end of file +$_POST['accounts'] = array('dev1', 'dev2'); +$tester->program->createStakeholder(1); +$result = $tester->program->getStakeholdersByPrograms(1); + +r(count($result)) && p('') && e('2'); // 创建id=1的项目集的干系人并查看数量。 +r($result) && p('0:account;1:account') && e('dev2;dev1'); // 创建id=1的项目集的干系人dev1,dev2并查看Account。 +system("./ztest init"); diff --git a/test/model/program/getbudgetleft.php b/test/model/program/getbudgetleft.php index 74aa772645..0e366e6d3e 100755 --- a/test/model/program/getbudgetleft.php +++ b/test/model/program/getbudgetleft.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); +$program1 = $tester->program->getById(11); +$program2 = $tester->program->getById(12); +$result1 = $tester->program->getBudgetLeft($program1); +$result2 = $tester->program->getBudgetLeft($program2); -$t_itemsid = array('1'); - -r($parentProjectSet->getBudgetLeft($t_itemsid[0])) && p() && e('0'); // 查看父项目集id=1的预算剩余 \ No newline at end of file +r($result) && p() && e('0'); // 查看父项目集id=1的预算剩余 diff --git a/test/model/program/getchildren.php b/test/model/program/getchildren.php index 96326969c1..8a8a156d03 100755 --- a/test/model/program/getchildren.php +++ b/test/model/program/getchildren.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); -$t_findnu = array('1', '22', '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 +r($tester->program->getChildren(1)) && p() && e('9'); // 通过id查找id=1的子项目集个数 +r($tester->program->getChildren(22)) && p() && e('7'); // 通过id查找id=22的子项目集个数 +r($tester->program->getChildren(221)) && p() && e('0'); // 通过id查找id=221的子项目集个数 diff --git a/test/model/program/getparentpairs.php b/test/model/program/getparentpairs.php index 8a2149b575..03c6bfe6ab 100755 --- a/test/model/program/getparentpairs.php +++ b/test/model/program/getparentpairs.php @@ -13,7 +13,11 @@ pid=1 */ -$ParentProjectSet = new Program('admin'); +global $tester; +$tester->loadModel('program'); +$program1 = $tester->program->getParentPairs(); +$program2 = $tester->program->getParentPairs('waterfall'); -r($ParentProjectSet->getCount1()) && p() && e('11'); // -r($ParentProjectSet->getParentPairs()) && p('1') && e(''); // 获取父项目集的id/name关联数组 \ No newline at end of file +r(count($program1)) && p() && e('7'); // 获取所有父项目集的数量 +r(count($program2)) && p() && e('1'); // 获取瀑布类型父项目集的数量 +r($program1) && p('1') && e('/项目集1'); // 获取ID为1的父项目集的名称 diff --git a/test/model/program/getparentpm.php b/test/model/program/getparentpm.php index 0150d8a870..7433c0b947 100755 --- a/test/model/program/getparentpm.php +++ b/test/model/program/getparentpm.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > 0 */ -$getPM = new Program('admin'); +global $tester; +$tester->loadModel('program'); + +$programIdList = array(1, 2, 3); +$parentPM = $tester->program->getParentPM($programIdList); +a($parentPM);die; /* GetParentPM($programIdList). */ -r($getPM->getParentPM('1')) && p() && e('0'); // \ No newline at end of file +r($getPM->getParentPM('1')) && p() && e('0'); // diff --git a/test/model/program/getprogresslist.php b/test/model/program/getprogresslist.php index f5c591fce2..d4e95b04dd 100755 --- a/test/model/program/getprogresslist.php +++ b/test/model/program/getprogresslist.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); +$progressList = $tester->program->getProgressList(); -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 +r(count($progressList)) && p() && e('120'); // 获取项目和项目集的个数 +r($progressList) && p('1') && e('41'); // 获取id=1的项目的进度 +r($progressList) && p('11') && e('45'); // 获取id=11的项目集的进度 diff --git a/test/model/program/gettopbyid.php b/test/model/program/gettopbyid.php index aaa710cc1b..12d472e321 100755 --- a/test/model/program/gettopbyid.php +++ b/test/model/program/gettopbyid.php @@ -1,9 +1,8 @@ #!/usr/bin/env php loadModel('program'); +$top1 = $tester->program->getTopByID(1); +$top1000 = $tester->program->getTopByID(1000); -$program_id = array(1, 1000); - -r($t->getByID3($program_id[0])) && p() && e('1'); //获取项目集1最上级的项目集id -r($t->getByID3($program_id[1])) && p() && e('Not Found'); //获取项目集1000最上级的项目集id \ No newline at end of file +r($top1) && p() && e('1'); //获取项目集1最上级的项目集id +r($top1000) && p() && e('0'); //获取项目集1000最上级的项目集id diff --git a/test/model/program/gettoppairs.php b/test/model/program/gettoppairs.php index 58a674e8cb..30add3b6f9 100755 --- a/test/model/program/gettoppairs.php +++ b/test/model/program/gettoppairs.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); -$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 +r(count($tester->program->getTopPairs())) && p() && e('10'); // 获取系统中所有顶级项目集数量 +r(count($tester->program->getTopPairs('', 'noclosed'))) && p() && e('10'); // 获取系统中所有未关闭的顶级项目集数量 +r(count($tester->program->getTopPairs('', '', true))) && p() && e('10'); // 获取系统中所有顶级项目集数量 diff --git a/test/model/program/gettoppath.php b/test/model/program/gettoppath.php new file mode 100644 index 0000000000..426f94621b --- /dev/null +++ b/test/model/program/gettoppath.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +loadModel('program'); +$path1 = ',2,3,4,'; +$path2 = '100,101'; + +r($tester->program->getTopByPath($path1)) && p() && e('2'); // 传入一个path,返回最顶级path +r($tester->program->getTopByPath($path2)) && p() && e('100'); // 传入一个path,返回最顶级path diff --git a/test/model/program/gettreemenu.php b/test/model/program/gettreemenu.php new file mode 100644 index 0000000000..efd0c0f9ba --- /dev/null +++ b/test/model/program/gettreemenu.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +loadModel('program'); +$programs1 = $tester->program->getTreeMenu(1); + +r(strlen($programs1)) && p() && e('789'); // 查看返回的字符个数 diff --git a/test/model/program/hasunfinished.php b/test/model/program/hasunfinished.php index 67d934dc72..4e616b1334 100755 --- a/test/model/program/hasunfinished.php +++ b/test/model/program/hasunfinished.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); +$program1 = $tester->program->getById(1); +$program2 = $tester->program->getById(2); -$unFinish = 1; - -r($program->getUnfinished($unFinish)) && p() && e('9'); // 获取项目集1下未完成的项目和项目集 \ No newline at end of file +r($tester->program->hasUnfinished($program1)) && p() && e('9'); // 获取项目集1下未完成的项目和项目集数量 +r($tester->program->hasUnfinished($program2)) && p() && e('7'); // 获取项目集2下未完成的项目和项目集数量 diff --git a/test/model/program/isclickable.php b/test/model/program/isclickable.php new file mode 100644 index 0000000000..e8019a13a7 --- /dev/null +++ b/test/model/program/isclickable.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +> dev2;dev1 + +*/ + +global $tester; +$tester->loadModel('program'); + +$program1 = $tester->program->getById(1); +$program2 = $tester->program->getById(2); + +r($tester->program->isClickable($program1, 'close')) && p('') && e('1'); // 传入项目集1,动作为closed,判断是否可点击 +r($tester->program->isClickable($program1, 'activate')) && p('') && e('0'); // 传入项目集1,动作为activate,判断是否可点击 +r($tester->program->isClickable($program1, 'suspend')) && p('') && e('1'); // 传入项目集1,动作为suspend,判断是否可点击 +r($tester->program->isClickable($program2, 'close')) && p('') && e('1'); // 传入项目集2,动作为closed,判断是否可点击 +r($tester->program->isClickable($program2, 'activate')) && p('') && e('0'); // 传入项目集2,动作为activate,判断是否可点击 +r($tester->program->isClickable($program2, 'suspend')) && p('') && e('1'); // 传入项目集2,动作为activate,判断是否可点击 diff --git a/test/model/program/settreepath.php b/test/model/program/settreepath.php index f9e57a98df..91d6381257 100755 --- a/test/model/program/settreepath.php +++ b/test/model/program/settreepath.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('program'); -$findId = array(12, 1000); +$before = $tester->program->getById(12); +$tester->program->setTreePath(12); +$after = $tester->program->getById(12); -r($program->setTreePath($findId[0])) && p('path') && e(',2,12,'); // 查找id=12的项目集的path \ No newline at end of file +r($before) && p('path') && e(',2,12,'); // 设置之前的项目集的path +r($after) && p('path') && e(',2,12,'); // 设置之后的项目集的path +system('./ztest init'); diff --git a/test/model/program/update.php b/test/model/program/update.php index 660a4b04e5..a81e60f420 100755 --- a/test/model/program/update.php +++ b/test/model/program/update.php @@ -2,6 +2,7 @@ updateProgram(10)) && p('message:end') && 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,完成日期不能大于父项目集的完成日期');// 项目集开始时间小于父项目集时 -system("./ztest init"); \ No newline at end of file +$data = array( + 'parent' => '0', + 'name' => '测试更新项目集十', + 'begin' => '2020-10-10', + 'end' => '2022-06-01', + 'acl' => 'private', + 'budget' => '100', + 'budgetUnit' => 'CNY', + 'syncPRJUnit' => true, + 'exchangeRate' => '', + 'whitelist' => array('dev10', 'dev12') +); + +$normalProgram = $data; + +$emptyTitleProgram = $data; +$emptyTitleProgram['name'] = '项目集1'; + +$emptyBeginProgram = $data; +$emptyBeginProgram['begin'] = ''; + +$emptyEndProgram = $data; +$emptyEndProgram['end'] = ''; + +$beginGtEndProgram = $data; +$beginGtEndProgram['begin'] = '2022-07-01'; + +$beginLtParentProgram = $data; +$beginLtParentProgram['parent'] = '9'; +$beginLtParentProgram['begin'] = '2019-01-01'; + +r($program->update(10, $normalProgram)) && p('name') && e('测试更新项目集十'); // 正常更新项目集的情况 +r($program->update(10, $emptyTitleProgram)) && p('message[name]:0') && e('『项目集名称』已经有『项目集1』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 更新项目集名称重复时 +r($program->update(10, $emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 当计划完成为空时更新项目集信息 +r($program->update(10, $emptyEndProgram)) && p('message:end') && e('子项目的最大完成日期:2022-05-27,父项目的完成日期不能小于子项目的最大完成日期'); //当计划完成小于计划开始时 +r($program->update(10, $beginGtEndProgram)) && p('message:begin') && e('子项目集的最小开始日期:2022-02-01,父项目集的开始日期不能大于子项目集的最小开始日期'); // 父项目集的开始日期大于子项目集的开始日期时 +r($program->update(10, $beginLtParentProgram)) && p('message:begin;message:end') && e('父项目集的开始日期:2022-02-09,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2022-04-16,完成日期不能大于父项目集的完成日期'); // 项目集开始、结束日期和子项目不符的情况 +system("./ztest init"); diff --git a/test/ztest b/test/ztest index 0eacb5393e..e2b1377185 100755 --- a/test/ztest +++ b/test/ztest @@ -58,6 +58,9 @@ switch($argv[1]) case 'kanban': ztfRun('model/kanban'); break; + case 'my': + ztfRun('model/my'); + break; case 'model': ztfRun('model'); break;