diff --git a/extension/lite/custom/ext/config/lite.php b/extension/lite/custom/ext/config/lite.php index 6ca05649d1..a7dc31e411 100644 --- a/extension/lite/custom/ext/config/lite.php +++ b/extension/lite/custom/ext/config/lite.php @@ -2,7 +2,6 @@ $config->custom->requiredModules = array(); $config->custom->requiredModules[10] = 'project'; $config->custom->requiredModules[20] = 'story'; -$config->custom->requiredModules[35] = 'execution'; $config->custom->requiredModules[40] = 'task'; $config->custom->requiredModules[80] = 'doc'; $config->custom->requiredModules[85] = 'user'; diff --git a/extension/lite/execution/ext/control/create.php b/extension/lite/execution/ext/control/create.php new file mode 100644 index 0000000000..cd8f6aed3a --- /dev/null +++ b/extension/lite/execution/ext/control/create.php @@ -0,0 +1,10 @@ +config->execution->create->requiredFields = 'name,code,begin,end'; + parent::create($projectID, $executionID, $copyExecutionID, $planID, $confirm, $productID, $extra); + } +} \ No newline at end of file diff --git a/extension/lite/execution/ext/control/edit.php b/extension/lite/execution/ext/control/edit.php new file mode 100644 index 0000000000..c7796cbc34 --- /dev/null +++ b/extension/lite/execution/ext/control/edit.php @@ -0,0 +1,10 @@ +config->execution->edit->requiredFields = 'name,code,begin,end'; + parent::edit($executionID, $action, $extra); + } +} \ No newline at end of file diff --git a/extension/lite/kanban/ext/view/view.lite.html.hook.php b/extension/lite/kanban/ext/view/view.lite.html.hook.php index 77f9eb2951..a3351704a6 100644 --- a/extension/lite/kanban/ext/view/view.lite.html.hook.php +++ b/extension/lite/kanban/ext/view/view.lite.html.hook.php @@ -1,3 +1,7 @@ \ No newline at end of file diff --git a/extension/lite/user/ext/lang/zh-cn/lite.php b/extension/lite/user/ext/lang/zh-cn/lite.php index d2f5818794..1617abafa0 100644 --- a/extension/lite/user/ext/lang/zh-cn/lite.php +++ b/extension/lite/user/ext/lang/zh-cn/lite.php @@ -1,2 +1,3 @@ user->task = '任务'; +$lang->user->noticeFeedbackUserLimit = "迅捷企业版用户数已经达到授权的上限,不能继续添加用户!"; diff --git a/extension/lite/user/ext/view/batchcreate.lite.html.hook.php b/extension/lite/user/ext/view/batchcreate.lite.html.hook.php new file mode 100644 index 0000000000..59dcd3daa2 --- /dev/null +++ b/extension/lite/user/ext/view/batchcreate.lite.html.hook.php @@ -0,0 +1,70 @@ + +dao->select("COUNT('*') as count")->from(TABLE_USER) + ->where('deleted')->eq(0) + ->beginIF($this->config->edition != 'open')->andWhere("visions")->ne('lite')->fi() + ->fetch('count'); +js::set('userCount', $userCount); +js::set('userMaxCount', $userMaxCount); +js::set('noticeUserCreate', str_replace('%maxcount%', $userMaxCount, $lang->user->noticeUserCreate)); + +if($this->config->edition != 'open') +{ + $liteCount = $this->dao->select("COUNT('*') as count")->from(TABLE_USER)->where('deleted')->eq(0)->andWhere("visions")->eq('lite')->fetch('count'); + $liteMaxCount = $properties['lite']['value']; + js::set('liteCount', $liteCount); + js::set('liteMaxCount', $liteMaxCount); + js::set('noticeFeedbackCreate', str_replace('%maxcount%', $liteMaxCount, $lang->user->noticeFeedbackCreate)); +} +?> + + diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 6ae1237f45..2d93b300d9 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -524,7 +524,7 @@ class baseEntry /* Format value. */ if(!$isArray) { - $object->$key = $this->cast($object->$key, $type); + $object->$key = $this->cast(trim($object->$key, ','), $type); continue; } diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 1d702b267b..a94bfdc9e8 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -66,7 +66,7 @@ class gitlab } else { - $commits = $this->getCommitsByPath($file->path); + $commits = $this->getCommitsByPath($file->path, '', '', 1); if(empty($commits)) continue; $commit = $commits[0]; @@ -108,7 +108,7 @@ class gitlab $file = $this->fetch($api, $param); if(!isset($file->file_name)) return false; - $commits = $this->getCommitsByPath($path); + $commits = $this->getCommitsByPath($path, '', '', 1); $file->revision = $file->commit_id; $file->size = $this->formatBytes($file->size); @@ -636,10 +636,13 @@ class gitlab * Get commits by path. * * @param string $path + * @param string $fromRevision + * @param string $toRevision + * @param int $perPage * @access public * @return array */ - public function getCommitsByPath($path, $fromRevision = '', $toRevision = '') + public function getCommitsByPath($path, $fromRevision = '', $toRevision = '', $perPage = 0) { $path = ltrim($path, DIRECTORY_SEPARATOR); $api = "commits"; @@ -662,10 +665,11 @@ class gitlab { $since = $fromDate; } - if($since) $param->since = $since; if($until) $param->until = $until; + if($perPage) $param->per_page = $perPage; + return $this->fetch($api, $param); } @@ -742,7 +746,7 @@ class gitlab { $params = (array) $params; $params['private_token'] = $this->token; - $params['per_page'] = 100; + $params['per_page'] = isset($params['per_page']) ? $params['per_page'] : 100; $api = ltrim($api, '/'); $api = $this->root . $api . '?' . http_build_query($params); diff --git a/module/build/model.php b/module/build/model.php index 5470d7266f..323ae85c58 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -202,6 +202,7 @@ class buildModel extends model $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD) ->where('id')->in($buildIdList) ->beginIF($objectType === 'execution')->andWhere('execution')->eq($objectID)->fi() + ->beginIF($objectType === 'project')->andWhere('project')->eq($objectID)->fi() ->fetchPairs(); } diff --git a/module/caselib/view/showimport.html.php b/module/caselib/view/showimport.html.php index a2bb3dcff0..dad8d594e0 100644 --- a/module/caselib/view/showimport.html.php +++ b/module/caselib/view/showimport.html.php @@ -112,7 +112,7 @@ $(function() } echo html::hidden('isEndPage', $isEndPage ? 1 : 0); echo html::hidden('pagerID', $pagerID); - echo '   ' . html::backButton(); + echo '   ' . html::a($this->createLink('caselib', 'browse', "libID=$libID"), $lang->goback, '', 'class="btn btn-wide"'); echo '   ' . sprintf($lang->file->importPager, $allCount, $pagerID, $allPager); ?> diff --git a/module/design/control.php b/module/design/control.php index 601a926bca..4607719e4f 100644 --- a/module/design/control.php +++ b/module/design/control.php @@ -230,6 +230,7 @@ class design extends control $this->view->stories = $this->loadModel('story')->getProductStoryPairs($design->product); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->actions = $this->loadModel('action')->getList('design', $design->id); + $this->view->repos = $this->loadModel('repo')->getRepoPairs('project', $design->project); $this->display(); } diff --git a/module/design/js/view.js b/module/design/js/view.js index 169bc7dcd8..07bfc10662 100644 --- a/module/design/js/view.js +++ b/module/design/js/view.js @@ -1,4 +1,19 @@ $(function() { $('#subNavbar .nav li[data-id=' + type.toLowerCase() + ']').addClass('active'); + $('#linkCommit').click(function() + { + if(repos.length == 0) + { + var onlybody = config.onlybody; + config.onlybody = 'no'; + + var link = createLink('repo', 'create', 'objectID=' + projectID); + + config.onlybody = onlybody; + window.parent.$.apps.open(link, 'project'); + + return false; + } + }); }) diff --git a/module/design/js/viewcommit.js b/module/design/js/viewcommit.js index 56db3f864e..6d486b3137 100644 --- a/module/design/js/viewcommit.js +++ b/module/design/js/viewcommit.js @@ -10,9 +10,7 @@ $(function() var link = createLink('repo', 'create', 'objectID=' + projectID); config.onlybody = onlybody; - window.parent.$.apps.open(link, 'devops'); - - parent.$('#triggerModal').modal('hide'); + window.parent.$.apps.open(link, 'project'); return false; } diff --git a/module/design/view/view.html.php b/module/design/view/view.html.php index 0f723b76e8..a00c782294 100644 --- a/module/design/view/view.html.php +++ b/module/design/view/view.html.php @@ -12,6 +12,8 @@ ?> type);?> + +project);?> diff --git a/module/release/lang/en.php b/module/release/lang/en.php index 0e4c7114b0..5ebeea5f34 100644 --- a/module/release/lang/en.php +++ b/module/release/lang/en.php @@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = 'QA Manager'; $lang->release->notifyList['SC'] = 'Story Creator'; $lang->release->notifyList['ET'] = "{$lang->execution->common} Team Members"; $lang->release->notifyList['PT'] = "Project Team Members"; +$lang->release->notifyList['CT'] = "Copy To"; diff --git a/module/release/lang/zh-cn.php b/module/release/lang/zh-cn.php index d0f59ad659..149a5921c2 100644 --- a/module/release/lang/zh-cn.php +++ b/module/release/lang/zh-cn.php @@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = '测试负责人'; $lang->release->notifyList['SC'] = '需求提交人'; $lang->release->notifyList['ET'] = "所在{$lang->execution->common}团队成员"; $lang->release->notifyList['PT'] = "所在项目团队成员"; +$lang->release->notifyList['CT'] = "抄送给"; diff --git a/module/release/model.php b/module/release/model.php index a1360ff42a..128917fcf9 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -281,21 +281,18 @@ class releaseModel extends model /** * Get notify persons. * - * @param string $notfiyList - * @param int $productID - * @param int $buildID - * @param int $releaseID + * @param object $release * @access public * @return array */ - public function getNotifyPersons($notifyList = '', $productID = 0, $buildID = 0, $releaseID = 0) + public function getNotifyPersons($release) { - if(empty($notifyList)) return array(); + if(empty($release->notify)) return array(); /* Init vars. */ $notifyPersons = array(); $managerFields = ''; - $notifyList = explode(',', $notifyList); + $notifyList = explode(',', $release->notify); foreach($notifyList as $notify) { @@ -303,10 +300,10 @@ class releaseModel extends model { $managerFields .= $notify . ','; } - elseif($notify == 'SC' and !empty($buildID)) + elseif($notify == 'SC' and !empty($release->build)) { - $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch('stories'); - $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($releaseID)->fetch('stories'); + $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($release->build)->fetch('stories'); + $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($release->id)->fetch('stories'); $stories = trim($stories, ','); if(empty($stories)) continue; @@ -314,7 +311,7 @@ class releaseModel extends model $openedByList = $this->dao->select('openedBy')->from(TABLE_STORY)->where('id')->in($stories)->fetchPairs(); $notifyPersons += $openedByList; } - elseif(($notify == 'ET' or $notify == 'PT') and !empty($buildID)) + elseif(($notify == 'ET' or $notify == 'PT') and !empty($release->build)) { $type = $notify == 'ET' ? 'execution' : 'project'; $members = $this->dao->select('t2.account')->from(TABLE_BUILD)->alias('t1') @@ -326,12 +323,16 @@ class releaseModel extends model $notifyPersons += $members; } + elseif($notify == 'CT' and !empty($release->mailto)) + { + $notifyPersons += explode(',', trim($release->mailto, ',')); + } } if(!empty($managerFields)) { $managerFields = trim($managerFields, ','); - $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch(); + $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($release->product)->fetch(); foreach($managerUsers as $account) { if(!isset($notifyPersons[$account])) $notifyPersons[$account] = $account; @@ -577,7 +578,7 @@ class releaseModel extends model /* Get notifiy persons. */ $notifyPersons = array(); - if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release->notify, $release->product, $release->build, $release->id); + if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release); foreach($notifyPersons as $account) { diff --git a/module/story/control.php b/module/story/control.php index 5d86256837..056edfe336 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1018,21 +1018,7 @@ class story extends control $module = $this->app->tab == 'project' ? 'projectstory' : 'story'; - if(isonlybody()) - { - $execution = $this->execution->getByID($this->session->execution); - if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); - $kanbanData = json_encode($kanbanData); - - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - return print(js::reload('parent.parent')); - } - } + if(isonlybody()) return print(js::reload('parent.parent')); if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); return print(js::locate($this->createLink($module, 'view', "storyID=$storyID"), 'parent')); @@ -1130,7 +1116,8 @@ class story extends control $storyID = (int)$storyID; $story = $this->story->getById($storyID, $version, true); - if(!$story) return print(js::error($this->lang->notFound) . js::locate($this->createLink('product', 'index'))); + $linkModuleName = $this->config->vision == 'lite' ? 'project' : 'product'; + if(!$story) return print(js::error($this->lang->notFound) . js::locate($this->createLink($linkModuleName, 'index'))); $story = $this->story->mergeReviewer($story, true); diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 78ff05105a..a1230ac20a 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = 'Estimate value must be number.'; $lang->story->estimateMustBePlus = 'Estimated value cannot be negative'; $lang->story->confirmChangeBranch = $lang->SRCommon . ' %s is linked to the plan of its linked branch. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan of its linked branch. Do you want to continue edit ' . $lang->SRCommon . '?'; $lang->story->confirmChangePlan = $lang->SRCommon . ' %s is linked to the branch of its plan. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan. Do you want to continue edit branch ?'; +$lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist'; $lang->story->form = new stdclass(); $lang->story->form->area = 'Scope'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index ff0751f10c..e0303c441a 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = '估算值必须是数字'; $lang->story->estimateMustBePlus = '估算值不能是负数'; $lang->story->confirmChangeBranch = $lang->SRCommon . '%s已关联在之前所属分支的计划中,调整分支后,' . $lang->SRCommon . '将从之前所属分支的计划中移除,请确认是否继续修改上述' . $lang->SRCommon . '的分支。'; $lang->story->confirmChangePlan = $lang->SRCommon . '%s已关联在之前计划的所属分支中,调整分支后,' . $lang->SRCommon . '将会从计划中移除,请确认是否继续修改计划的所属分支。'; +$lang->story->errorDuplicateStory = $lang->SRCommon . '%s不存在'; $lang->story->form = new stdclass(); $lang->story->form->area = "该{$lang->SRCommon}所属范围"; diff --git a/module/story/model.php b/module/story/model.php index d5eedc2706..0663530312 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1553,6 +1553,16 @@ class storyModel extends model ->removeIF($this->post->closedReason != 'subdivided', 'childStories') ->get(); + if(!empty($story->duplicateStory)) + { + $duplicateStoryID = $this->dao->select('id')->from(TABLE_STORY)->where('id')->eq($story->duplicateStory)->fetch(); + if(empty($duplicateStoryID)) + { + dao::$errors[] = sprintf($this->lang->story->errorDuplicateStory, $story->duplicateStory); + return false; + } + } + $this->lang->story->comment = $this->lang->comment; $this->dao->update(TABLE_STORY)->data($story, 'comment') ->autoCheck() diff --git a/module/story/view/tasks.html.php b/module/story/view/tasks.html.php index 3c9f772564..a1f9e2e247 100644 --- a/module/story/view/tasks.html.php +++ b/module/story/view/tasks.html.php @@ -55,7 +55,11 @@ include '../../common/view/chart.html.php'; estimate;?> consumed;?> left;?> -
+ +
+
progress;?>
+
+ diff --git a/module/testcase/control.php b/module/testcase/control.php index 5896cf1b99..69ae38ebc1 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -964,6 +964,10 @@ class testcase extends control $libID = $productID; $libraries = $this->loadModel('caselib')->getLibraries(); + /* Remove story custom fields from caselib */ + $this->config->testcase->customBatchEditFields = str_replace(',story', '', $this->config->testcase->customBatchEditFields); + $this->config->testcase->custom->batchEditFields = str_replace(',story', '', $this->config->testcase->custom->batchEditFields); + /* Set caselib menu. */ $this->caselib->setLibMenu($libraries, $libID); @@ -1029,11 +1033,11 @@ class testcase extends control $productIdList = array(); foreach($cases as $case) $productIdList[$case->product] = $case->product; - $branches = 0; $branchTagOption = array(); $products = $this->product->getByIdList($productIdList); foreach($products as $product) { + $branches = 0; if($product->type != 'normal') { $branches = $this->loadModel('branch')->getList($product->id, 0, 'all'); @@ -1055,6 +1059,9 @@ class testcase extends control $showSuhosinInfo = common::judgeSuhosinSetting($countInputVars); if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars); + $stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch); + $this->view->stories = array('' => '', 'ditto' => $this->lang->testcase->ditto) + $stories; + /* Set custom. */ foreach(explode(',', $this->config->testcase->customBatchEditFields) as $field) $customFields[$field] = $this->lang->testcase->$field; $this->view->customFields = $customFields; diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index 9df9b0827a..2b56dfa9a5 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -57,7 +57,7 @@ $(function() var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num); $.get(storyLink, function(stories) { - if(!stories) modules = ''; + if(!stories) stories = ''; $('#story' + num).replaceWith(stories); $('#story' + num + "_chosen").remove(); $('#story' + num).next('.picker').remove(); diff --git a/module/testcase/js/common.js b/module/testcase/js/common.js index f70847fd18..d29efaf6cd 100644 --- a/module/testcase/js/common.js +++ b/module/testcase/js/common.js @@ -361,21 +361,32 @@ function updateStepID() */ function loadStories(productID, moduleID, num) { - var branchIDName = config.currentMethod == 'batchcreate' ? '#branch' : '#branches'; + var branchIDName = (config.currentMethod == 'batchcreate' || config.currentMethod == 'showimport') ? '#branch' : '#branches'; var branchID = $(branchIDName + num).val(); var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num); $.get(storyLink, function(stories) { - if(!stories) modules = ''; - for(var i = num; i < 10 ; i ++) + if(!stories) stories = ''; + if(config.currentMethod == 'batchcreate') { - if(i != num && $('#module' + i).val() != 'ditto') break; - var nowStories = stories.replaceAll('story' + num, 'story' + i); - $('#story' + i).replaceWith(nowStories); - $('#story' + i + "_chosen").remove(); - $('#story' + i).next('.picker').remove(); - $('#story' + i).attr('name', 'story[' + i + ']'); - $('#story' + i).chosen(); + for(var i = num; i < 10 ; i ++) + { + if(i != num && $('#module' + i).val() != 'ditto') break; + var nowStories = stories.replaceAll('story' + num, 'story' + i); + $('#story' + i).replaceWith(nowStories); + $('#story' + i + "_chosen").remove(); + $('#story' + i).next('.picker').remove(); + $('#story' + i).attr('name', 'story[' + i + ']'); + $('#story' + i).chosen(); + } + } + else + { + $('#story' + num).replaceWith(stories); + $('#story' + num + "_chosen").remove(); + $('#story' + num).next('.picker').remove(); + $('#story' + num).attr('name', 'story[' + num + ']'); + $('#story' + num).chosen(); } }); } diff --git a/module/testcase/js/showimport.js b/module/testcase/js/showimport.js index aede447892..b6490a25c1 100644 --- a/module/testcase/js/showimport.js +++ b/module/testcase/js/showimport.js @@ -1,25 +1,31 @@ -$(document).on('mouseup', '[id^=story].chosen-with-drop', function() +$("[name^='product']").each(function() { - var select = $(this).prev('select'); - var id = $(select).attr('id'); - var index = id.substring(5); - var moduleID = $('#module' + index).val(); - var branch = $('#branch' + index).length > 0 ? $('#branch' + index).val() : 0; - if(moduleID == 'ditto') + var id = $(this).attr('id'); + $(this).attr('id', 'product' + id.match(/\d+/)); +}); + +$("[name^='branch']").each(function() +{ + var id = $(this).attr('id'); + $(this).attr('id', 'branch' + id.match(/\d+/)); +}); + +$("[name^='story']").each(function() +{ + var id = $(this).attr('id'); + var num = id.substring(5); + var productID = $('#product' + num).val(); + var branchID = $('#branch' + num).val(); + var moduleID = $('#module' + num).val(); + var storyID = $("#story" + num).val(); + var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num); + $.get(storyLink, function(stories) { - for(var i = index - 1; i >=0; i--) - { - if($('#module' + i).val() != 'ditto') - { - moduleID = $('#module' + i).val(); - break; - } - } - } - var link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID='+ ($(select).val() || '0') + '&onlyOption=true&status=noclosed&limit=0&type=null'); - var $story = $('#story' + index); - if($story.data('loadLink') !== link) - { - $story.load(link, function(){$story.data('loadLink', link).trigger("chosen:updated");}); - } + if(!stories) stories = ''; + $('#story' + num).replaceWith(stories); + $('#story' + num + "_chosen").remove(); + $('#story' + num).next('.picker').remove(); + $('#story' + num).attr('name', 'story[' + num + ']').chosen(); + $('#story' + num).val(storyID).trigger('chosen:updated'); + }); }); diff --git a/module/testcase/model.php b/module/testcase/model.php index 0fea861510..4948202db4 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -894,12 +894,12 @@ class testcaseModel extends model /* Process data if the value is 'ditto'. */ foreach($caseIDList as $caseID) { - if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3; - if($data->branches[$caseID] == 'ditto') $data->branches[$caseID] = isset($prev['branch']) ? $prev['branch'] : 0; - if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0; - if($data->story[$caseID] == 'ditto') $data->story[$caseID] = isset($prev['story']) ? $prev['story'] : 0; - if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : ''; - if($data->story[$caseID] == '') $data->story[$caseID] = 0; + if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3; + if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0; + if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : ''; + if($data->story[$caseID] == '') $data->story[$caseID] = 0; + if(isset($data->branches[$caseID]) and $data->branches[$caseID] == 'ditto') $data->branches[$caseID] = isset($prev['branch']) ? $prev['branch'] : 0; + if($data->story[$caseID] == 'ditto') $data->story[$caseID] = isset($prev['story']) ? $prev['story'] : 0; $prev['pri'] = $data->pris[$caseID]; $prev['type'] = $data->types[$caseID]; @@ -953,8 +953,9 @@ class testcaseModel extends model if(!dao::isError()) { - $isLibCase = ($oldCase->lib and empty($oldCase->product)); - $titleChanged = ($case->title != $oldCase->title); + $isLibCase = ($oldCase->lib and empty($oldCase->product)); + $titleChanged = ($case->title != $oldCase->title); + $case->product = $oldCase->product; if($isLibCase and $titleChanged) $this->dao->update(TABLE_CASE)->set('`title`')->eq($case->title)->where('`fromCaseID`')->eq($caseID)->exec(); $this->updateCase2Project($oldCase, $case, $caseID); @@ -1247,9 +1248,9 @@ class testcaseModel extends model else { /* Compare every step. */ - foreach($oldStep as $id => $oldStep) + foreach($oldStep as $id => $step) { - if(trim($oldStep->desc) != trim($steps[$id]->desc) or trim($oldStep->expect) != $steps[$id]->expect) + if(trim($step->desc) != trim($steps[$id]->desc) or trim($step->expect) != $steps[$id]->expect) { $stepChanged = true; break; @@ -1388,10 +1389,14 @@ class testcaseModel extends model if($module != 'ditto') $prevModule = $module; if($module == 'ditto') $data->module[$i] = $prevModule; } - foreach($data->branch as $i => $branch) + + if(isset($data->branch)) { - if($branch != 'ditto') $prevBranch = $branch; - if($branch == 'ditto') $data->branch[$i] = $prevBranch; + foreach($data->branch as $i => $branch) + { + if($branch != 'ditto') $prevBranch = $branch; + if($branch == 'ditto') $data->branch[$i] = $prevBranch; + } } $libCases = $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)->andWhere('id')->in($data->caseIdList)->fetchAll('id'); @@ -1889,7 +1894,7 @@ class testcaseModel extends model if($methodName == 'review') { - $status = zget($case, 'status', $status); + $status = zget($case, 'status', ''); if($this->post->result == 'pass') return 'normal'; diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index 2bbe8ce596..d58a558d58 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -52,6 +52,7 @@ testcase->branch;?> '>testcase->module;?> + '>testcase->story;?> testcase->title;?> testcase->type;?> '>testcase->precondition;?> @@ -91,6 +92,7 @@ ' style='overflow:visible'> '/')), $cases[$caseID]->module, "class='form-control chosen' onchange='loadStories($productID, this.value, $caseID)'");?> + ' style='overflow:visible'>story, "class='form-control chosen'");?>
diff --git a/module/testcase/view/showimport.html.php b/module/testcase/view/showimport.html.php index ea49c6a892..5421771f9e 100644 --- a/module/testcase/view/showimport.html.php +++ b/module/testcase/view/showimport.html.php @@ -82,7 +82,7 @@ $(function() title, ENT_QUOTES), "class='form-control'")?> branch) and $case->branch != 0) ? $modules[BRANCH_MAIN] + $modules[$case->branch] : $modules[BRANCH_MAIN];?> - module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange'")?> + module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange' onchange='loadStories($case->product, this.value, $key)'")?> story) ? $case->story : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->story : '');?> diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 7d826b7982..037d25161c 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -73,16 +73,14 @@ class testsuite extends control /* Append id for secend sort. */ $sort = common::appendOrder($orderBy); - $suites = $this->testsuite->getSuites($productID, $sort, $pager); + $productName = isset($this->products[$productID]) ? $this->products[$productID] : ''; + $suites = $this->testsuite->getSuites($productID, $sort, $pager, 'all'); if(empty($suites) and $pageID > 1) { - $pager = pager::init(0, $recPerPage, 1); - $suites = $this->testsuite->getSuites($productID, $sort, $pager); + $pager = pager::init(0, $recPerPage, 1); + $suites = $this->testsuite->getSuites($productID, $sort, $pager, 'all'); } - $productName = isset($this->products[$productID]) ? $this->products[$productID] : ''; - $suites = $this->testsuite->getSuites($productID, $sort, $pager); - $this->view->title = $productName . $this->lang->testsuite->common; $this->view->position[] = html::a($this->createLink('testsuite', 'browse', "productID=$productID"), $productName); $this->view->position[] = $this->lang->testsuite->common; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index ae73a101fd..a0d52b572f 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -87,16 +87,17 @@ class testsuiteModel extends model * @param int $productID * @param string $orderBy * @param object $pager + * @param string $param * @access public * @return array */ - public function getSuites($productID, $orderBy = 'id_desc', $pager = null) + public function getSuites($productID, $orderBy = 'id_desc', $pager = null, $param = '') { return $this->dao->select("*")->from(TABLE_TESTSUITE) ->where('product')->eq((int)$productID) ->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi() ->andWhere('deleted')->eq(0) - ->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))") + ->beginIF(strpos($param, 'all') === false)->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))")->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); diff --git a/module/testsuite/view/browse.html.php b/module/testsuite/view/browse.html.php index a23dd8f834..a4d24ca90e 100644 --- a/module/testsuite/view/browse.html.php +++ b/module/testsuite/view/browse.html.php @@ -57,7 +57,7 @@ id"), sprintf('%03d', $suite->id));?> - + type == 'public') echo "{$lang->testsuite->authorList['public']} ";?> type == 'private') echo "{$lang->testsuite->authorList['private']} ";?> id"), $suite->name);?> diff --git a/module/testsuite/view/edit.html.php b/module/testsuite/view/edit.html.php index 7991c10536..6b826c3510 100644 --- a/module/testsuite/view/edit.html.php +++ b/module/testsuite/view/edit.html.php @@ -28,7 +28,7 @@ desc), "rows=10 class='form-control'");?> printExtendFields($suite, 'table');?> - type != 'library'):?> + type != 'library' and $suite->type != 'unit'):?> testsuite->author;?> testsuite->authorList, $suite->type);?> diff --git a/test/class/design.class.php b/test/class/design.class.php index 7e09e62658..c99db6abd5 100644 --- a/test/class/design.class.php +++ b/test/class/design.class.php @@ -157,24 +157,6 @@ class designTest return $objects; } - public function getAffectedScopeTest($design = 0) - { - $objects = $this->objectModel->getAffectedScope($design = 0); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function getListTest($projectID = 0, $productID = 0, $type = 'all', $param = 0, $orderBy = 'id_desc', $pager = null) - { - $objects = $this->objectModel->getList($projectID = 0, $productID = 0, $type = 'all', $param = 0, $orderBy = 'id_desc', $pager = null); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - public function getCommitTest($designID = 0, $pager = null) { $objects = $this->objectModel->getCommit($designID = 0, $pager = null); @@ -183,40 +165,4 @@ class designTest return $objects; } - - public function getBySearchTest($projectID = 0, $productID = 0, $queryID = 0, $orderBy = 'id_desc', $pager = null) - { - $objects = $this->objectModel->getBySearch($projectID = 0, $productID = 0, $queryID = 0, $orderBy = 'id_desc', $pager = null); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function setMenuTest($projectID, $products, $productID = 0) - { - $objects = $this->objectModel->setMenu($projectID, $products, $productID = 0); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function buildSearchFormTest($queryID = 0, $actionURL = '') - { - $objects = $this->objectModel->buildSearchForm($queryID = 0, $actionURL = ''); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function printAssignedHtmlTest($design = '', $users = '') - { - $objects = $this->objectModel->printAssignedHtml($design = '', $users = ''); - - if(dao::isError()) return dao::getError(); - - return $objects; - } } diff --git a/test/class/personnel.class.php b/test/class/personnel.class.php new file mode 100644 index 0000000000..bab07168c7 --- /dev/null +++ b/test/class/personnel.class.php @@ -0,0 +1,262 @@ +objectModel = $tester->loadModel('personnel'); + $tester->app->loadClass('dao'); + } + /** + * Get accessible personnel test + * + * @param int $programID + * @param int $deptID + * @param string $browseType + * @param int $queryID + * @access public + * @return array + */ + public function getAccessiblePersonnelTest($programID = 0, $deptID = 0, $browseType = 'all', $queryID = 0) + { + $objects = $this->objectModel->getAccessiblePersonnel($programID, $deptID, $browseType, $queryID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Check if you have permission to view the program + * + * @param int mixed $programID + * @param string mixed $account + * @access public + * @return bool + */ + public function canViewProgramTest($programID, $account) + { + $objects = $this->objectModel->canViewProgram($programID, $account); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get invest test + * + * @param int $programID + * @access public + * @return array + */ + public function getInvestTest($programID = 0) + { + $objects = $this->objectModel->getInvest($programID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getRiskInvestTest($accounts, $projectID) + { + $projects = $this->personnel->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($projectID)->fetchAll('id'); + $objects = $this->objectModel->getRiskInvest($accounts, $projects); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getIssueInvestTest($accounts, $projects) + { + $objects = $this->objectModel->getIssueInvest($accounts, $projects); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getBugAndStoryInvestTest($accounts, $programID) + { + $objects = $this->objectModel->getBugAndStoryInvest($accounts, $programID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getInvolvedProjectsTest($projects) + { + $objects = $this->objectModel->getInvolvedProjects($projects); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get involved executions test + * + * @param array mixed $projectID + * @access public + * @return void + */ + public function getInvolvedExecutionsTest($projectID) + { + global $tester; + $project = $tester->dao->select('id')->from(TABLE_PROJECT)->where('project')->in($projectID)->fetchall('project'); + $objects = $this->objectModel->getInvolvedExecutions($project); + a($objects); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getProjectTaskInvestTest($projects, $accounts) + { + $objects = $this->objectModel->getProjectTaskInvest($projects, $accounts); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getUserEffortHoursTest($userTasks) + { + $objects = $this->objectModel->getUserEffortHours($userTasks); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getUserHoursTest($userTasks) + { + $objects = $this->objectModel->getUserHours($userTasks); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getSprintAndStageTest($projects) + { + $objects = $this->objectModel->getSprintAndStage($projects); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getCopiedObjectsTest($objectID, $objectType) + { + $objects = $this->objectModel->getCopiedObjects($objectID, $objectType); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getWhitelistTest($objectID = 0, $objectType = '', $orderBy = 'id_desc', $pager = '') + { + $objects = $this->objectModel->getWhitelist($objectID = 0, $objectType = '', $orderBy = 'id_desc', $pager = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getWhitelistAccountTest($objectID = 0, $objectType = '') + { + $objects = $this->objectModel->getWhitelistAccount($objectID = 0, $objectType = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function updateWhitelistTest($users = array(), $objectType = '', $objectID = 0, $type = 'whitelist', $source = 'add', $updateType = 'replace') + { + $objects = $this->objectModel->updateWhitelist($users = array(), $objectType = '', $objectID = 0, $type = 'whitelist', $source = 'add', $updateType = 'replace'); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function addWhitelistTest($objectType = '', $objectID = 0) + { + $objects = $this->objectModel->addWhitelist($objectType = '', $objectID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function deleteProductWhitelistTest($productID, $account = '') + { + $objects = $this->objectModel->deleteProductWhitelist($productID, $account = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function deleteProgramWhitelistTest($programID = 0, $account = '') + { + $objects = $this->objectModel->deleteProgramWhitelist($programID = 0, $account = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function deleteProjectWhitelistTest($objectID = 0, $account = '') + { + $objects = $this->objectModel->deleteProjectWhitelist($objectID = 0, $account = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function deleteExecutionWhitelistTest($executionID, $account = '') + { + $objects = $this->objectModel->deleteExecutionWhitelist($executionID, $account = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function deleteWhitelistTest($users = array(), $objectType = 'program', $objectID = 0, $groupID = 0) + { + $objects = $this->objectModel->deleteWhitelist($users = array(), $objectType = 'program', $objectID = 0, $groupID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function createMemberLinkTest($dept = 0, $programID = 0) + { + $objects = $this->objectModel->createMemberLink($dept = 0, $programID = 0); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function buildSearchFormTest($queryID = 0, $actionURL = '') + { + $objects = $this->objectModel->buildSearchForm($queryID = 0, $actionURL = ''); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/class/testcase.class.php b/test/class/testcase.class.php index 37d196839d..5642b59f97 100644 --- a/test/class/testcase.class.php +++ b/test/class/testcase.class.php @@ -7,6 +7,90 @@ class testcaseTest $this->objectModel = $tester->loadModel('testcase'); } + /** + * Test create a case. + * + * @param array $param + * @access public + * @return array + */ + public function createTest($param) + { + $bugID = 0; + + $_POST['product'] = '1'; + $_POST['module'] = '1821'; + $_POST['type'] = 'feature'; + $_POST['stage'] = array('', 'unittest'); + $_POST['story'] = '4'; + $_POST['color'] = ''; + $_POST['pri'] = '3'; + $_POST['precondition'] = '前置条件'; + $_POST['steps'] = array('1' => '1','1.1' => '1.1', '1.2' => '1.2', '2' => '2', '3' => '3', '4' => ''); + $_POST['stepType'] = array('1' => 'group','1.1' => 'item', '1.2' => 'item', '2' => 'step', '3' => 'item', '4' => 'step'); + $_POST['expects'] = array('1' => '','1.1' => '', '1.2' => '', '2' => '', '3' => '', '4' => ''); + $_POST['keywords'] = '关键词1,关键词2'; + $_POST['status'] = 'normal'; + $_POST['labels'] = array(''); + $_POST['files'] = array(''); + + foreach($param as $field => $value) $_POST[$field] = $value; + + $objects = $this->objectModel->create($bugID); + + unset($_POST); + + if(dao::isError()) return isset($param['type']) ? dao::getError()['type'][0] : dao::getError()['title'][0]; + + return $objects; + } + + /** + * Test batch create cases. + * + * @param array $param + * @access public + * @return int + */ + function batchCreateTest($param) + { + $productID = 1; + $branch = 0; + $storyID = 0; + + $module = array(0, 0, 0); + $story = array(0, 0, 0); + $title = array('测试批量创建1', '测试批量创建2', '测试批量创建3'); + $color = array('#3da7f5', '', '#ffaf38'); + $type = array('performance', 'config', 'install'); + $pri = array('1', '2', '3'); + $precondition = array('测试批量创建前置1', '测试批量创建前置2', '测试批量创建前置3'); + $keywords = array('测试批量创建关键词1', '测试批量创建关键词2', '测试批量创建关键词3'); + $stage = array(array('smoke'), array('bvt'), array('intergrate')); + $needReview = array(0, 0, 0); + + $_POST['module'] = $module; + $_POST['story'] = $story; + $_POST['title'] = $title; + $_POST['color'] = $color; + $_POST['type'] = $type; + $_POST['pri'] = $pri; + $_POST['precondition'] = $precondition; + $_POST['keywords'] = $keywords; + $_POST['stage'] = $stage; + $_POST['needReview'] = $needReview; + + foreach($param as $field => $value) $_POST[$field] = $value; + + $objects = $this->objectModel->batchCreate($productID, $branch, $storyID); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return count($objects); + } + /** * Test get cases of a module. * @@ -51,15 +135,6 @@ class testcaseTest return $objects; } - public function getProjectCasesTest($projectID, $orderBy = 'id_desc', $pager = null, $browseType = '') - { - $objects = $this->objectModel->getProjectCases($projectID, $orderBy = 'id_desc', $pager = null, $browseType = ''); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - /** * Test get execution cases. * @@ -134,9 +209,19 @@ class testcaseTest return $objects; } - public function getTestCasesTest($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager, $auto = 'no') + /** + * Test get test cases. + * + * @param int $productID + * @param string $browseType + * @param int $queryID + * @param string $auto + * @access public + * @return array + */ + public function getTestCasesTest($productID, $browseType, $queryID, $auto = 'no') { - $objects = $this->objectModel->getTestCases($productID, $branch, $browseType, $queryID, $moduleID, $sort, $pager, $auto = 'no'); + $objects = $this->objectModel->getTestCases($productID, 0, $browseType, $queryID, $moduleID, 'id_desc', null, $auto); if(dao::isError()) return dao::getError(); @@ -182,6 +267,20 @@ class testcaseTest return $objects; } + /** + * Test get cases by type. + * + * @param int $productID + * @param int $branch + * @param string $type + * @param string $status + * @param int $moduleID + * @param string $orderBy + * @param object $pager + * @param string $auto + * @access public + * @return int + */ public function getByStatusTest($productID = 0, $branch = 0, $type = 'all', $status = 'all', $moduleID = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no') { $objects = $this->objectModel->getByStatus($productID, $branch, $type, $status, $moduleID, $orderBy, $pager, $auto); @@ -191,6 +290,13 @@ class testcaseTest return count($objects); } + /** + * Test get stories' cases. + * + * @param int $storyID + * @access public + * @return array + */ public function getStoryCasesTest($storyID) { $objects = $this->objectModel->getStoryCases($storyID); @@ -216,19 +322,64 @@ class testcaseTest return $counts; } - public function updateTest($caseID) + /** + * Test update a case. + * + * @param array $param + * @access public + * @return int + */ + public function updateTest($param = array()) { - $objects = $this->objectModel->update($caseID); + $caseId = 1; + $case = $this->objectModel->getById($caseId); + + $_POST['title'] = $case->title; + $_POST['color'] = $case->color; + $_POST['precondition'] = $case->precondition; + $_POST['steps'] = array('用例步骤描述1'); + $_POST['stepType'] = array('step'); + $_POST['expects'] = array('这是用例预期结果1'); + $_POST['comment'] = ''; + $_POST['labels'] = ''; + $_POST['lastEditedDate'] = $case->lastEditedDate; + $_POST['product'] = $case->product; + $_POST['module'] = $case->module; + $_POST['story'] = $case->story; + $_POST['type'] = $case->type; + $_POST['stage'] = $case->stage; + $_POST['pri'] = $case->pri; + $_POST['status'] = $case->status; + $_POST['keywords'] = $case->keywords; + + foreach($param as $field => $value) $_POST[$field] = $value; + + $change = $this->objectModel->update('1'); + if($change == array()) $change = '没有数据更新'; + + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + return $change; } - public function reviewTest($caseID) + /** + * Test review case. + * + * @param int $caseID + * @param object $case + * @access public + * @return array + */ + public function reviewTest($caseID, $case) { + foreach($case as $field => $value) $_POST[$field] = $value; + $objects = $this->objectModel->review($caseID); + unset($_POST); + if(dao::isError()) return dao::getError(); return $objects; @@ -251,23 +402,21 @@ class testcaseTest return $objects; } - public function getCases2LinkTest($caseID, $browseType = 'bySearch', $queryID = 0) - { - $objects = $this->objectModel->getCases2Link($caseID, $browseType = 'bySearch', $queryID = 0); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - public function batchUpdateTest($param = array()) + /** + * Test batch update cases. + * + * @param array $param + * @access public + * @return array + */ + public function batchUpdateTest($index, $param = array()) { $batchUpdateField['caseIDList'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4); $batchUpdateField['pris'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4); $batchUpdateField['statuses'] = array('1' => 'wait', '2' => 'normal', '3' => 'blocked', '4' => 'investigate'); $batchUpdateField['modules'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0); $batchUpdateField['branches'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0); - $batchUpdateField['story'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0); + $batchUpdateField['story'] = array('1' => 2, '2' => 2, '3' => 2, '4' => 2); $batchUpdateField['product'] = array('1' => 1, '2' => 1, '3' => 1, '4' => 1); $batchUpdateField['title'] = array('1' => '这个是测试用例1', '2' => '这个是测试用例2', '3' => '这个是测试用例3', '4' => '这个是测试用例4'); $batchUpdateField['color'] = array('1' => '#3da7f5', '2' => '#75c941', '3' => '#2dbdb2', '4' => '#797ec9'); @@ -286,7 +435,7 @@ class testcaseTest if(dao::isError()) return dao::getError(); - return $objects; + return $objects[$index][0]; } /** @@ -343,22 +492,69 @@ class testcaseTest return $objects; } - public function joinStepTest($steps) + /** + * Test join steps to a string, thus can diff them. + * + * @param array $stepIDList + * @access public + * @return string + */ + public function joinStepTest($stepIDList) { - $objects = $this->objectModel->joinStep($steps); + global $tester; + $steps = $tester->dao->select('*')->from(TABLE_CASESTEP)->where('id')->in($stepIDList)->fetchAll(); + + $string = $this->objectModel->joinStep($steps); if(dao::isError()) return dao::getError(); - return $objects; + $string = str_replace("\n", ' ', $string); + return $string; } - public function createFromImportTest($productID, $branch = 0) + /** + * Test create from import. + * + * @param int $productID + * @param array $param + * @access public + * @return string + */ + public function createFromImportTest($productID, $param = array()) { - $objects = $this->objectModel->createFromImport($productID, $branch = 0); + global $tester; + + $_POST['product'] = array('1' => '1', '2' => '1'); + $_POST['keywords'] = array('1' => '这是关键词1', '2' => '这是关键词2'); + $_POST['title'] = array('1' => '导入测试用例1', '2' => '导入测试用例2'); + $_POST['module'] = array('1' => '0', '2' => '0'); + $_POST['story'] = array('1' => '2', '2' => '2'); + $_POST['pri'] = array('1' => '1', '2' => '2'); + $_POST['type'] = array('1' => 'performance', '2' => 'feature'); + $_POST['stage'] = array('1' => array('0' => 'feature'), '2' => array('0' => 'unittest')); + $_POST['precondition'] = array('1' => '这是前置条件1', '2' => '这是前置条件2'); + $_POST['stepType'] = array('1' => array('1' => 'step'), '2' => array('1' => 'step')); + $_POST['desc'] = array('1' => array('1' => '用例步骤描述1'), '2' => array('1' => '用例步骤描述2')); + $_POST['expect'] = array('1' => array('1' => '这是用例预期结果1'), '2' => array('1' => '这是用例预期结果2')); + $_POST['isEndPage'] = '1'; + $_POST['pagerID'] = '1'; + + foreach($param as $field => $value) $_POST[$field] = $value; + + $fileName = __DIR__ . DS . 'a.txt'; + fopen($fileName, 'a'); + $tester->session->fileImport = $fileName; + + $this->objectModel->createFromImport($productID, 0); + + + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + $objects = $tester->dao->select('*')->from(TABLE_CASE)->where('product')->eq(1)->andWhere('lib')->eq(0)->markLeft()->andWhere('id')->gt(560)->orWhere('id')->in('1,2')->markRight()->fetchAll('title'); + $titles = implode(',', array_keys($objects)); + return $titles; } /** @@ -377,21 +573,27 @@ class testcaseTest return $object; } - public function importFromLibTest($productID) + /** + * Test import case from Lib. + * + * @param int $productID + * @param array $caseIdList + * @access public + * @return array + */ + public function importFromLibTest($productID, $caseIdList = array()) { - $objects = $this->objectModel->importFromLib($productID); + $_POST['module'] = array('410' => 0, '409' => 'ditto', '408' => 'ditto', '407' => 'ditto', '406' => 'ditto', '405' => 'ditto', '404' => 'ditto', '403' => 'ditto', '402' => 'ditto', '401' => 'ditto'); + $_POST['caseIdList'] = $caseIdList; - if(dao::isError()) return dao::getError(); + $this->objectModel->importFromLib($productID); - return $objects; - } - - public function buildSearchFormTest($productID, $products, $queryID, $actionURL, $projectID = 0) - { - $objects = $this->objectModel->buildSearchForm($productID, $products, $queryID, $actionURL, $projectID = 0); + unset($_POST); if(dao::isError()) return dao::getError(); + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_CASE)->where('fromCaseID')->in($caseIdList)->orderBy('id_asc')->fetchAll(); return $objects; } @@ -427,29 +629,106 @@ class testcaseTest return $object ? 1 : 2; } - public function syncCase2ProjectTest($case, $caseID) + /** + * Test sync case to project. + * + * @param int $caseID + * @access public + * @return int + */ + public function syncCase2ProjectTest($caseID) { - $objects = $this->objectModel->syncCase2Project($case, $caseID); + global $tester; + $tester->dao->delete()->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->exec(); + $case = $this->objectModel->getByID($caseID); + $this->objectModel->syncCase2Project($case, $caseID); if(dao::isError()) return dao::getError(); + $objects = $tester->dao->select('*')->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->fetchAll(); + return count($objects); + } + + /** + * Test deal with the relationship between the case and project when edit the case. + * + * @param int $caseID + * @param string $objectType + * @param int $objectID + * @access public + * @return array + */ + public function updateCase2ProjectTest($caseID, $objectType, $objectID) + { + $oldCase = $this->objectModel->getByID($caseID); + + $case = new stdclass(); + $case->title = $oldCase->title; + $case->color = $oldCase->color; + $case->precondition = $oldCase->precondition; + $case->lastEditedDate = $oldCase->lastEditedDate; + $case->product = $objectType == 'product' ? $objectID : $oldCase->product; + $case->module = $oldCase->module; + $case->story = $objectType == 'story' ? $objectID : $oldCase->story; + $case->type = $oldCase->type; + $case->stage = $oldCase->stage; + $case->pri = $oldCase->pri; + $case->status = $oldCase->status; + $case->keywords = $oldCase->keywords; + $case->version = $oldCase->version + 1; + $case->linkCase = $oldCase->linkCase; + $case->lastEditedBy = $oldCase->lastEditedBy; + $case->branch = $oldCase->branch; + + $this->objectModel->updateCase2Project($oldCase, $case, $caseID); + + if(dao::isError()) return dao::getError(); + + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->fetchAll(); return $objects; } - public function updateCase2ProjectTest($oldCase, $case, $caseID) + /** + * Test get status for different method. + * + * @param string $methodName + * @param object $case + * @param array $param + * @access public + * @return array + */ + public function getStatusTest($methodName, $case = null, $param = array()) { - $objects = $this->objectModel->updateCase2Project($oldCase, $case, $caseID); + if($methodName == 'update') + { + $case = $this->objectModel->getByID(1); + $_POST['title'] = $case->title; + $_POST['color'] = $case->color; + $_POST['precondition'] = $case->precondition; + $_POST['steps'] = array('用例步骤描述1'); + $_POST['stepType'] = array('step'); + $_POST['expects'] = array('这是用例预期结果1'); + $_POST['comment'] = ''; + $_POST['labels'] = ''; + $_POST['lastEditedDate'] = $case->lastEditedDate; + $_POST['product'] = $case->product; + $_POST['module'] = $case->module; + $_POST['story'] = $case->story; + $_POST['type'] = $case->type; + $_POST['stage'] = $case->stage; + $_POST['pri'] = $case->pri; + $_POST['status'] = $case->status; + $_POST['keywords'] = $case->keywords; - if(dao::isError()) return dao::getError(); + foreach($param as $field => $value) $_POST[$field] = $value; + } - return $objects; - } + $objects = $this->objectModel->getStatus($methodName, $case); - public function getStatusTest($methodName, $case = null) - { - $objects = $this->objectModel->getStatus($methodName, $case = null); + unset($_POST); - if(dao::isError()) return dao::getError(); + if(dao::isError()) return dao::getError()[0]; return $objects; } diff --git a/test/data/build.yaml b/test/data/build.yaml index ef47edb2ff..22ec785fa2 100644 --- a/test/data/build.yaml +++ b/test/data/build.yaml @@ -51,10 +51,22 @@ fields: format: "YYYY-MM-DD" - field: stories - range: '' + fields: + - field: story1 + range: 2-400:4 + prefix: "" + postfix: "," + - field: story2 + range: 4-400:4 - field: bugs - range: ' ' + fields: + - field: bug1 + range: 1-300:3 + prefix: "" + postfix: "," + - field: bug2 + range: 2-400:3 - field: builder range: 1-8 diff --git a/test/data/testtask.yaml b/test/data/testtask.yaml index c4be09cd5b..ea7096c970 100644 --- a/test/data/testtask.yaml +++ b/test/data/testtask.yaml @@ -14,7 +14,7 @@ fields: note: "测试单名称" fields: - field: name1 - range: 测试单,单元测试 + range: 测试单{50},单元测试{50} - field: name2 range: 1-50,1-50 prefix: "" diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index 0796e8d6a9..18839c9dd7 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -344,6 +344,7 @@ class Processor $this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (3, 'admin', 'user', '用户测试条件', 'a:48:{s:13:\"fieldrealname\";s:0:\"\";s:10:\"fieldemail\";s:0:\"\";s:9:\"fielddept\";s:0:\"\";s:12:\"fieldaccount\";s:0:\"\";s:9:\"fieldrole\";s:0:\"\";s:10:\"fieldphone\";s:0:\"\";s:9:\"fieldjoin\";s:0:\"\";s:12:\"fieldvisions\";s:3:\"rnd\";s:7:\"fieldid\";s:0:\"\";s:13:\"fieldcommiter\";s:1:\"0\";s:11:\"fieldgender\";s:1:\"m\";s:7:\"fieldqq\";s:0:\"\";s:10:\"fieldskype\";s:0:\"\";s:13:\"fielddingding\";s:0:\"\";s:11:\"fieldweixin\";s:0:\"\";s:10:\"fieldslack\";s:0:\"\";s:13:\"fieldwhatsapp\";s:0:\"\";s:12:\"fieldaddress\";s:0:\"\";s:12:\"fieldzipcode\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:8:\"realname\";s:9:\"operator1\";s:7:\"include\";s:6:\"value1\";s:9:\"白名单\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:5:\"email\";s:9:\"operator2\";s:7:\"include\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:4:\"dept\";s:9:\"operator3\";s:6:\"belong\";s:6:\"value3\";s:0:\"\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:7:\"account\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:4:\"role\";s:9:\"operator5\";s:1:\"=\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:5:\"phone\";s:9:\"operator6\";s:7:\"include\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:4:\"user\";s:9:\"actionURL\";s:74:\"/index.php?m=company&f=browse&browseType=all¶m=myQueryID&type=bysearch\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"lite\";}', '(( 1 AND `realname` LIKE \'%白名单%\' ) AND ( 1 ))', '0');"); $this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (4, 'admin', 'projectBuild', '项目版本搜索', 'a:38:{s:9:\"fieldname\";s:0:\"\";s:12:\"fieldproduct\";s:0:\"\";s:12:\"fieldscmPath\";s:0:\"\";s:13:\"fieldfilePath\";s:0:\"\";s:9:\"fielddate\";s:0:\"\";s:12:\"fieldbuilder\";s:0:\"\";s:9:\"fielddesc\";s:0:\"\";s:14:\"fieldexecution\";s:0:\"\";s:7:\"fieldid\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:4:\"name\";s:9:\"operator1\";s:7:\"include\";s:6:\"value1\";s:8:\"版本7\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:2:\"id\";s:9:\"operator2\";s:1:\"=\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:7:\"product\";s:9:\"operator3\";s:1:\"=\";s:6:\"value3\";s:0:\"\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:7:\"scmPath\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:8:\"filePath\";s:9:\"operator5\";s:7:\"include\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:4:\"date\";s:9:\"operator6\";s:1:\"=\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:12:\"projectBuild\";s:9:\"actionURL\";s:73:\"/index.php?m=project&f=build&projectID=13&type=bysearch&queryID=myQueryID\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"more\";}', '(( 1 AND `name` LIKE \'%版本7%\' ) AND ( 1 ))', '0');"); $this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (5, 'admin', 'executionBuild', '执行版本搜索', 'a:37:{s:9:\"fieldname\";s:0:\"\";s:12:\"fieldproduct\";s:0:\"\";s:12:\"fieldscmPath\";s:0:\"\";s:13:\"fieldfilePath\";s:0:\"\";s:9:\"fielddate\";s:0:\"\";s:12:\"fieldbuilder\";s:0:\"\";s:9:\"fielddesc\";s:0:\"\";s:7:\"fieldid\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:4:\"name\";s:9:\"operator1\";s:7:\"include\";s:6:\"value1\";s:8:\"版本17\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:2:\"id\";s:9:\"operator2\";s:1:\"=\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:7:\"product\";s:9:\"operator3\";s:1:\"=\";s:6:\"value3\";s:0:\"\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:7:\"scmPath\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:8:\"filePath\";s:9:\"operator5\";s:7:\"include\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:4:\"date\";s:9:\"operator6\";s:1:\"=\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:14:\"executionBuild\";s:9:\"actionURL\";s:78:\"/index.php?m=execution&f=build&executionID=101&type=bysearch&queryID=myQueryID\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"more\";}', '(( 1 AND `name` LIKE \'%版本17%\' ) AND ( 1 ))', '0');"); + $this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (6, 'admin', 'design', '设计搜索', 'a:37:{s:9:\"fieldtype\";s:0:\"\";s:9:\"fieldname\";s:0:\"\";s:11:\"fieldcommit\";s:0:\"\";s:14:\"fieldcreatedBy\";s:0:\"\";s:16:\"fieldcreatedDate\";s:0:\"\";s:15:\"fieldassignedTo\";s:0:\"\";s:10:\"fieldstory\";s:1:\"0\";s:7:\"fieldid\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:2:\"id\";s:9:\"operator1\";s:1:\"=\";s:6:\"value1\";s:0:\"\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:4:\"type\";s:9:\"operator2\";s:1:\"=\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:4:\"name\";s:9:\"operator3\";s:7:\"include\";s:6:\"value3\";s:19:\"这是一个设计1\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:6:\"commit\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:9:\"createdBy\";s:9:\"operator5\";s:1:\"=\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:11:\"createdDate\";s:9:\"operator6\";s:1:\"=\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:6:\"design\";s:9:\"actionURL\";s:86:\"/index.php?m=design&f=browse&projectID=41&productID=31&type=bySearch&queryID=myQueryID\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"more\";}', '(( 1 AND `name` LIKE \'%这是一个设计1%\' ) AND ( 1 ))', '0');"); } private function initMessage() diff --git a/test/model/action/getlist.php b/test/model/action/getlist.php index b5d7b47d0f..ee81c8740e 100755 --- a/test/model/action/getlist.php +++ b/test/model/action/getlist.php @@ -17,42 +17,42 @@ $objectId = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, $action = new actionTest(); -r($action->getListTest($objectType[0], $objectId[0])) && p('id,actor,extra') && e("1,admin,1"); // 测试获取objectType product objectId 1的动态信息 -r($action->getListTest($objectType[1], $objectId[1])) && p('id,actor,extra') && e("2,dev17,1"); // 测试获取objectType story objectId 2的动态信息 -r($action->getListTest($objectType[2], $objectId[2])) && p('id,actor,extra') && e("3,test18,1"); // 测试获取objectType productplan objectId 3的动态信息 -r($action->getListTest($objectType[3], $objectId[3])) && p('id,actor,extra') && e("4,admin,1"); // 测试获取objectType release objectId 4的动态信息 -r($action->getListTest($objectType[4], $objectId[4])) && p('id,actor,extra') && e("5,dev17,11"); // 测试获取objectType project objectId 5的动态信息 -r($action->getListTest($objectType[5], $objectId[5])) && p('id,actor,extra') && e("6,test18,1"); // 测试获取objectType task objectId 6的动态信息 -r($action->getListTest($objectType[6], $objectId[6])) && p('id,actor,extra') && e("7,admin,1"); // 测试获取objectType build objectId 7的动态信息 -r($action->getListTest($objectType[7], $objectId[7])) && p('id,actor,extra') && e("8,dev17,1"); // 测试获取objectType bug objectId 8的动态信息 -r($action->getListTest($objectType[8], $objectId[8])) && p('id,actor,extra') && e("9,test18,2"); // 测试获取objectType testcase objectId 9的动态信息 -r($action->getListTest($objectType[9], $objectId[9])) && p('id,actor,extra') && e("10,admin,1"); // 测试获取objectType case objectId 10的动态信息 -r($action->getListTest($objectType[10], $objectId[10])) && p('id,actor,extra') && e("11,dev17,1"); // 测试获取objectType testtask objectId 11的动态信息 -r($action->getListTest($objectType[11], $objectId[11])) && p('id,actor,extra') && e("12,test18,1"); // 测试获取objectType user objectId 12的动态信息 -r($action->getListTest($objectType[12], $objectId[12])) && p('id,actor,extra') && e("13,admin,1"); // 测试获取objectType doc objectId 13的动态信息 -r($action->getListTest($objectType[13], $objectId[13])) && p('id,actor,extra') && e("14,dev17,1"); // 测试获取objectType doclib objectId 14的动态信息 -r($action->getListTest($objectType[14], $objectId[14])) && p('id,actor,extra') && e("15,test18,1"); // 测试获取objectType todo objectId 15的动态信息 -r($action->getListTest($objectType[15], $objectId[15])) && p('id,actor,extra') && e("16,admin,1"); // 测试获取objectType branch objectId 16的动态信息 -r($action->getListTest($objectType[16], $objectId[16])) && p('id,actor,extra') && e("17,dev17,1"); // 测试获取objectType module objectId 17的动态信息 +r($action->getListTest($objectType[0], $objectId[0])) && p('id,actor,extra') && e("1,admin,1"); // 测试获取objectType product objectId 1的动态信息 +r($action->getListTest($objectType[1], $objectId[1])) && p('id,actor,extra') && e("2,dev17,1"); // 测试获取objectType story objectId 2的动态信息 +r($action->getListTest($objectType[2], $objectId[2])) && p('id,actor,extra') && e("3,test18,1"); // 测试获取objectType productplan objectId 3的动态信息 +r($action->getListTest($objectType[3], $objectId[3])) && p('id,actor,extra') && e("4,admin,1"); // 测试获取objectType release objectId 4的动态信息 +r($action->getListTest($objectType[4], $objectId[4])) && p('id,actor,extra') && e("5,dev17,11"); // 测试获取objectType project objectId 5的动态信息 +r($action->getListTest($objectType[5], $objectId[5])) && p('id,actor,extra') && e("6,test18,1"); // 测试获取objectType task objectId 6的动态信息 +r($action->getListTest($objectType[6], $objectId[6])) && p('id,actor,extra') && e("7,admin,1"); // 测试获取objectType build objectId 7的动态信息 +r($action->getListTest($objectType[7], $objectId[7])) && p('id,actor,extra') && e("8,dev17,1"); // 测试获取objectType bug objectId 8的动态信息 +r($action->getListTest($objectType[8], $objectId[8])) && p('id,actor,extra') && e("9,test18,2"); // 测试获取objectType testcase objectId 9的动态信息 +r($action->getListTest($objectType[9], $objectId[9])) && p('id,actor,extra') && e("10,admin,1"); // 测试获取objectType case objectId 10的动态信息 +r($action->getListTest($objectType[10], $objectId[10])) && p('id,actor,extra') && e("11,dev17,1"); // 测试获取objectType testtask objectId 11的动态信息 +r($action->getListTest($objectType[11], $objectId[11])) && p('id,actor,extra') && e("12,test18,1"); // 测试获取objectType user objectId 12的动态信息 +r($action->getListTest($objectType[12], $objectId[12])) && p('id,actor,extra') && e("13,admin,1"); // 测试获取objectType doc objectId 13的动态信息 +r($action->getListTest($objectType[13], $objectId[13])) && p('id,actor,extra') && e("14,dev17,1"); // 测试获取objectType doclib objectId 14的动态信息 +r($action->getListTest($objectType[14], $objectId[14])) && p('id,actor,extra') && e("15,test18,1"); // 测试获取objectType todo objectId 15的动态信息 +r($action->getListTest($objectType[15], $objectId[15])) && p('id,actor,extra') && e("16,admin,1"); // 测试获取objectType branch objectId 16的动态信息 +r($action->getListTest($objectType[16], $objectId[16])) && p('id,actor,extra') && e("17,dev17,1"); // 测试获取objectType module objectId 17的动态信息 r($action->getListTest($objectType[17], $objectId[17])) && p('id,actor,extra') && e("18,test18,#1 项目集1"); // 测试获取objectType testsuite objectId 18的动态信息 -r($action->getListTest($objectType[18], $objectId[18])) && p('id,actor,extra') && e("19,admin,1"); // 测试获取objectType caselib objectId 19的动态信息 -r($action->getListTest($objectType[19], $objectId[19])) && p('id,actor,extra') && e("20,dev17,1"); // 测试获取objectType testreport objectId 20的动态信息 -r($action->getListTest($objectType[20], $objectId[20])) && p('id,actor,extra') && e("21,test18,1"); // 测试获取objectType entry objectId 21的动态信息 +r($action->getListTest($objectType[18], $objectId[18])) && p('id,actor,extra') && e("19,admin,1"); // 测试获取objectType caselib objectId 19的动态信息 +r($action->getListTest($objectType[19], $objectId[19])) && p('id,actor,extra') && e("20,dev17,1"); // 测试获取objectType testreport objectId 20的动态信息 +r($action->getListTest($objectType[20], $objectId[20])) && p('id,actor,extra') && e("21,test18,1"); // 测试获取objectType entry objectId 21的动态信息 r($action->getListTest($objectType[21], $objectId[21])) && p('id,actor,extra') && e("22,admin,1"); // 测试获取objectType webhook objectId 22的动态信息 -r($action->getListTest($objectType[22], $objectId[22])) && p('id,actor,extra') && e("23,dev17,1"); // 测试获取objectType review objectId 23的动态信息 -r($action->getListTest($objectType[0], $objectId[23])) && p('id,actor,extra') && e("24,test18,1"); // 测试获取objectType product objectId 24的动态信息 -r($action->getListTest($objectType[1], $objectId[24])) && p('id,actor,extra') && e("25,admin,1"); // 测试获取objectType story objectId 25的动态信息 -r($action->getListTest($objectType[2], $objectId[25])) && p('id,actor,extra') && e("26,dev17,1"); // 测试获取objectType productplan objectId 26的动态信息 -r($action->getListTest($objectType[3], $objectId[26])) && p('id,actor,extra') && e("27,test18,1"); // 测试获取objectType release objectId 27的动态信息 -r($action->getListTest($objectType[4], $objectId[27])) && p('id,actor,extra') && e("28,admin,33"); // 测试获取objectType project objectId 28的动态信息 -r($action->getListTest($objectType[5], $objectId[28])) && p('id,actor,extra') && e("29,dev17,1"); // 测试获取objectType task objectId 29的动态信息 -r($action->getListTest($objectType[6], $objectId[29])) && p('id,actor,extra') && e("30,test18,1"); // 测试获取objectType build objectId 30的动态信息 -r($action->getListTest($objectType[7], $objectId[30])) && p('id,actor,extra') && e("31,admin,1"); // 测试获取objectType bug objectId 31的动态信息 -r($action->getListTest($objectType[8], $objectId[31])) && p('id,actor,extra') && e("32,项目经理17,1"); // 测试获取objectType testcase objectId 32的动态信息 -r($action->getListTest($objectType[9], $objectId[32])) && p('id,actor,extra') && e("33,test18,1"); // 测试获取objectType case objectId 33的动态信息 -r($action->getListTest($objectType[10], $objectId[33])) && p('id,actor,extra') && e("34,admin,1"); // 测试获取objectType testtask objectId 34的动态信息 -r($action->getListTest($objectType[11], $objectId[34])) && p('id,actor,extra') && e("35,dev17,1"); // 测试获取objectType user objectId 35的动态信息 -r($action->getListTest($objectType[12], $objectId[35])) && p('id,actor,extra') && e("36,test18,1"); // 测试获取objectType doc objectId 36的动态信息 -r($action->getListTest($objectType[13], $objectId[36])) && p('id,actor,extra') && e("37,admin,1"); // 测试获取objectType doclib objectId 37的动态信息 -r($action->getListTest($objectType[14], $objectId[37])) && p('id,actor,extra') && e("38,dev17,1"); // 测试获取objectType todo objectId 38的动态信息 +r($action->getListTest($objectType[22], $objectId[22])) && p('id,actor,extra') && e("23,dev17,1"); // 测试获取objectType review objectId 23的动态信息 +r($action->getListTest($objectType[0], $objectId[23])) && p('id,actor,extra') && e("24,test18,1"); // 测试获取objectType product objectId 24的动态信息 +r($action->getListTest($objectType[1], $objectId[24])) && p('id,actor,extra') && e("25,admin,1"); // 测试获取objectType story objectId 25的动态信息 +r($action->getListTest($objectType[2], $objectId[25])) && p('id,actor,extra') && e("26,dev17,1"); // 测试获取objectType productplan objectId 26的动态信息 +r($action->getListTest($objectType[3], $objectId[26])) && p('id,actor,extra') && e("27,test18,1"); // 测试获取objectType release objectId 27的动态信息 +r($action->getListTest($objectType[4], $objectId[27])) && p('id,actor,extra') && e("28,admin,33"); // 测试获取objectType project objectId 28的动态信息 +r($action->getListTest($objectType[5], $objectId[28])) && p('id,actor,extra') && e("29,dev17,1"); // 测试获取objectType task objectId 29的动态信息 +r($action->getListTest($objectType[6], $objectId[29])) && p('id,actor,extra') && e("30,test18,1"); // 测试获取objectType build objectId 30的动态信息 +r($action->getListTest($objectType[7], $objectId[30])) && p('id,actor,extra') && e("31,admin,1"); // 测试获取objectType bug objectId 31的动态信息 +r($action->getListTest($objectType[8], $objectId[31])) && p('id,actor,extra') && e("32,项目经理17,1"); // 测试获取objectType testcase objectId 32的动态信息 +r($action->getListTest($objectType[9], $objectId[32])) && p('id,actor,extra') && e("33,test18,1"); // 测试获取objectType case objectId 33的动态信息 +r($action->getListTest($objectType[10], $objectId[33])) && p('id,actor,extra') && e("34,admin,1"); // 测试获取objectType testtask objectId 34的动态信息 +r($action->getListTest($objectType[11], $objectId[34])) && p('id,actor,extra') && e("35,dev17,1"); // 测试获取objectType user objectId 35的动态信息 +r($action->getListTest($objectType[12], $objectId[35])) && p('id,actor,extra') && e("36,test18,1"); // 测试获取objectType doc objectId 36的动态信息 +r($action->getListTest($objectType[13], $objectId[36])) && p('id,actor,extra') && e("37,admin,1"); // 测试获取objectType doclib objectId 37的动态信息 +r($action->getListTest($objectType[14], $objectId[37])) && p('id,actor,extra') && e("38,dev17,1"); // 测试获取objectType todo objectId 38的动态信息 r($action->getListTest($objectType[15], $objectId[38])) && p('id,actor,extra') && e("39,test18,项目版本版本1"); // 测试获取objectType branch objectId 39的动态信息 diff --git a/test/model/design/assign.php b/test/model/design/assign.php old mode 100644 new mode 100755 index a043aaaa5e..20b22d0b0e --- a/test/model/design/assign.php +++ b/test/model/design/assign.php @@ -10,6 +10,8 @@ title=测试 designModel->assign(); cid=1 pid=1 +设置指派人 >> dev10 + */ $designID = '17'; @@ -18,4 +20,4 @@ $noAssignedTo = array('comment' => '提交信息'); $design = new designTest(); r($design->assignTest($designID, $normalAssign)) && p('0:assignedTo') && e('dev10');//设置指派人 -r($design->assignTest($designID, $noAssignedTo)) && p('0:assignedTo') && e(''); //指派人为空 +r($design->assignTest($designID, $noAssignedTo)) && p('0:assignedTo') && e(''); //指派人为空 \ No newline at end of file diff --git a/test/model/design/batchcreate.php b/test/model/design/batchcreate.php old mode 100644 new mode 100755 index c1f41e26c2..700d522b4e --- a/test/model/design/batchcreate.php +++ b/test/model/design/batchcreate.php @@ -10,6 +10,13 @@ title=测试 designModel->batchCreate(); cid=1 pid=1 +批量创建设计数量统计 >> 4 +批量创建敏捷项目设计 >> 设计一 +批量创建瀑布项目设计 >> 32 +批量创建看板项目设计 >> 41 +不输入类型 >> 『设计类型』不能为空。 +不输入名字 >> 0 + */ $projectIDList = array('12', '32', '62', '13', '71', '72', '73', '75'); $productIDList = array('1', '21', '41'); @@ -25,6 +32,7 @@ $noNameDesign = array('story' => $storys, 'type' => $types, 'desc' => $desc); $noDescDesign = array('story' => $storys, 'type' => $types, 'name' => $names); $design = new designTest(); +r(count($design->batchCreateTest($projectIDList[7], $productIDList[0], $noDescDesign))) && p() && e('4'); //批量创建设计数量统计 r($design->batchCreateTest($projectIDList[0], $productIDList[0], $normalDesign)) && p('0:name') && e('设计一'); //批量创建敏捷项目设计 r($design->batchCreateTest($projectIDList[1], $productIDList[1], $normalDesign)) && p('0:project') && e('32'); //批量创建瀑布项目设计 r($design->batchCreateTest($projectIDList[2], $productIDList[2], $normalDesign)) && p('0:product') && e('41'); //批量创建看板项目设计 @@ -32,6 +40,5 @@ r($design->batchCreateTest($projectIDList[3], $productIDList[0], $noStoryDesign) r($design->batchCreateTest($projectIDList[4], $productIDList[0], $noTypeDesign)) && p('type:0') && e('『设计类型』不能为空。');//不输入类型 r($design->batchCreateTest($projectIDList[5], $productIDList[0], $noNameDesign)) && p() && e('0'); //不输入名字 r($design->batchCreateTest($projectIDList[6], $productIDList[0], $noDescDesign)) && p('0:desc') && e(''); //不输入详情 -r(count($design->batchCreateTest($projectIDList[7], $productIDList[0], $noDescDesign))) && p() && e('4'); //批量创建设计数量统计 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/design/buildsearchform.php b/test/model/design/buildsearchform.php deleted file mode 100644 index a3e8885051..0000000000 --- a/test/model/design/buildsearchform.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -buildSearchForm(); -cid=1 -pid=1 - -*/ - -$design = new designTest(); - -r($design->buildSearchFormTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/design/create.php b/test/model/design/create.php old mode 100644 new mode 100755 index 8422317beb..e68709721a --- a/test/model/design/create.php +++ b/test/model/design/create.php @@ -10,6 +10,13 @@ title=测试 designModel->create(); cid=1 pid=1 +不输入名称创建设计 >> 『设计名称』不能为空。 +创建hlds设计 >> hlds设计 +创建dds设计 >> 2 +创建dbds设计 >> 41 +创建ads设计 >> ADS +不输入类型创建设计 >> 『设计类型』不能为空。 + */ $projectIDList = array('11', '31', '61'); $products = array('1', '21', '41'); @@ -25,13 +32,13 @@ $noTypeDesign = array('product' => $products[0], 'story' => '1', 'name' => ' $noNameDesign = array('product' => $products[0], 'story' => '1', 'type' => $type[3]); $design = new designTest(); +r($design->createTest($projectIDList[0], $noNameDesign)) && p('name:0') && e('『设计名称』不能为空。'); //不输入名称创建设计 r($design->createTest($projectIDList[0], $hldsDesign)) && p('name') && e('hlds设计'); //创建hlds设计 r($design->createTest($projectIDList[1], $ddsDesign)) && p('story') && e('2'); //创建dds设计 -r($design->createTest($projectIDList[2], $dbdsDesign)) && p('product') && e('61'); //创建dbds设计 +r($design->createTest($projectIDList[2], $dbdsDesign)) && p('product') && e('41'); //创建dbds设计 r($design->createTest($projectIDList[0], $adsDesign)) && p('type') && e('ADS'); //创建ads设计 r($design->createTest($projectIDList[0], $noProductDesign)) && p('product') && e(''); //不输入产品创建设计 r($design->createTest($projectIDList[0], $noStoryDesign)) && p('story') && e(''); //不输入需求创建设计 r($design->createTest($projectIDList[0], $noTypeDesign)) && p('type:0') && e('『设计类型』不能为空。'); //不输入类型创建设计 -r($design->createTest($projectIDList[0], $noNameDesign)) && p('name:0') && e('『设计名称』不能为空。'); //不输入名称创建设计 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/design/getaffectedscope.php b/test/model/design/getaffectedscope.php deleted file mode 100644 index 77926c3055..0000000000 --- a/test/model/design/getaffectedscope.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -getAffectedScope(); -cid=1 -pid=1 - -*/ - -$design = new designTest(); - -r($design->getAffectedScopeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/design/getbyid.php b/test/model/design/getbyid.php old mode 100644 new mode 100755 index 805bc16f8b..36c5dedc69 --- a/test/model/design/getbyid.php +++ b/test/model/design/getbyid.php @@ -10,6 +10,9 @@ title=测试 designModel->getByID(); cid=1 pid=1 +正常根据id查询 >> 这是一个设计1 +查询不存在的设计id >> 0 + */ global $tester; $design = $tester->loadModel('design'); @@ -17,4 +20,4 @@ $design = $tester->loadModel('design'); $designIDList = array('0', '1'); r($design->getByID($designIDList[1])) && p('name') && e('这是一个设计1');//正常根据id查询 -r($design->getByID($designIDList[0])) && p() && e('0'); //查询不存在的设计id +r($design->getByID($designIDList[0])) && p() && e('0'); //查询不存在的设计id \ No newline at end of file diff --git a/test/model/design/getbysearch.php b/test/model/design/getbysearch.php old mode 100644 new mode 100755 index 080af401ca..355a205e3f --- a/test/model/design/getbysearch.php +++ b/test/model/design/getbysearch.php @@ -1,7 +1,6 @@ #!/usr/bin/env php getBySearch(); cid=1 pid=1 +不输入产品和项目查询 >> 0 +输入项目查询 >> 0 +输入产品查询 >> 0 +正常查询条件查询 >> 这是一个设计1 + */ +global $tester; +$design = $tester->loadModel('design'); -$design = new designTest(); +$productIDList = array('0', '31'); +$projectIDList = array('0', '41'); +$queryID = array('0', '6'); +$orderBy = array('id_desc', 'name_desc'); -r($design->getBySearchTest()) && p() && e(); \ No newline at end of file +r($design->getBySearch($projectIDList[0], $productIDList[0], $queryID[0], $orderBy[0])) && p() && e('0'); //不输入产品和项目查询 +r($design->getBySearch($projectIDList[1], $productIDList[0], $queryID[0], $orderBy[0])) && p() && e('0'); //输入项目查询 +r($design->getBySearch($projectIDList[0], $productIDList[1], $queryID[0], $orderBy[0])) && p() && e('0'); //输入产品查询 +r($design->getBySearch($projectIDList[1], $productIDList[1], $queryID[1], $orderBy[1])) && p('1:name') && e('这是一个设计1');//正常查询条件查询 \ No newline at end of file diff --git a/test/model/design/getcommit.php b/test/model/design/getcommit.php.bak similarity index 100% rename from test/model/design/getcommit.php rename to test/model/design/getcommit.php.bak diff --git a/test/model/design/getlist.php b/test/model/design/getlist.php old mode 100644 new mode 100755 index 107edf2276..9b0b8af2b0 --- a/test/model/design/getlist.php +++ b/test/model/design/getlist.php @@ -10,8 +10,47 @@ title=测试 designModel->getList(); cid=1 pid=1 +默认输入查询 >> 0 +不输入产品查询 >> 0 +不输入项目查询 >> 31 +项目和产品一起输入查询 >> 41 +HLDS类型设计查询 >> HLDS +DDS类型设计查询 >> DDS +DBDS类型设计查询 >> DBDS +ADS类型设计查询 >> ADS +不存在类型设计查询 >> 0 +查询条件查询设计 >> 这是一个设计1 +不输入项目查询统计 >> 4 +项目和产品一起输入查询统计 >> 4 +HLDS类型设计查询统计 >> 1 +DDS类型设计查询统计 >> 1 +DBDS类型设计查询统计 >> 1 +ADS类型设计查询统计 >> 1 + */ +global $tester; +$design = $tester->loadModel('design'); -$design = new designTest(); +$productIDList = array('0', '31'); +$projectIDList = array('0', '41'); +$types = array('all', 'bySearch', 'HLDS', 'DDS', 'DBDS', 'ADS', 'QT'); +$param = array('0', '6'); +$orderBy = array('id_desc', 'name_desc'); -r($design->getListTest()) && p() && e(); \ No newline at end of file +r($design->getList($projectIDList[0], $productIDList[0], $types[0], $param[0], $orderBy[0])) && p() && e('0'); //默认输入查询 +r($design->getList($projectIDList[1], $productIDList[0], $types[0], $param[0], $orderBy[0])) && p() && e('0'); //不输入产品查询 +r($design->getList($projectIDList[0], $productIDList[1], $types[0], $param[0], $orderBy[0])) && p('1:product') && e('31'); //不输入项目查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[0], $param[0], $orderBy[1])) && p('1:project') && e('41'); //项目和产品一起输入查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[2], $param[0], $orderBy[0])) && p('1:type') && e('HLDS'); //HLDS类型设计查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[3], $param[0], $orderBy[0])) && p('2:type') && e('DDS'); //DDS类型设计查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[4], $param[0], $orderBy[0])) && p('3:type') && e('DBDS'); //DBDS类型设计查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[5], $param[0], $orderBy[0])) && p('4:type') && e('ADS'); //ADS类型设计查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[6], $param[0], $orderBy[0])) && p() && e('0'); //不存在类型设计查询 +r($design->getList($projectIDList[1], $productIDList[1], $types[1], $param[1], $orderBy[0])) && p('1:name') && e('这是一个设计1');//查询条件查询设计 + +r(count($design->getList($projectIDList[0], $productIDList[1], $types[0], $param[0], $orderBy[0]))) && p() && e('4'); //不输入项目查询统计 +r(count($design->getList($projectIDList[1], $productIDList[1], $types[0], $param[0], $orderBy[1]))) && p() && e('4'); //项目和产品一起输入查询统计 +r(count($design->getList($projectIDList[1], $productIDList[1], $types[2], $param[0], $orderBy[0]))) && p() && e('1'); //HLDS类型设计查询统计 +r(count($design->getList($projectIDList[1], $productIDList[1], $types[3], $param[0], $orderBy[0]))) && p() && e('1'); //DDS类型设计查询统计 +r(count($design->getList($projectIDList[1], $productIDList[1], $types[4], $param[0], $orderBy[0]))) && p() && e('1'); //DBDS类型设计查询统计 +r(count($design->getList($projectIDList[1], $productIDList[1], $types[5], $param[0], $orderBy[0]))) && p() && e('1'); //ADS类型设计查询统计 \ No newline at end of file diff --git a/test/model/design/getpairs.php b/test/model/design/getpairs.php old mode 100644 new mode 100755 index 486225b07d..e088aacd14 --- a/test/model/design/getpairs.php +++ b/test/model/design/getpairs.php @@ -10,6 +10,13 @@ title=测试 designModel->getPairs(); cid=1 pid=1 +查询不存在的产品 >> 0 +查询不存在的类型 >> 0 +查询HLDS设计 >> 1:这是一个设计1 +查询DDS设计 >> 2:这是一个设计2 +查询DBDS设计 >> 3:这是一个设计3 +查询ADS设计 >> 4:这是一个设计4 + */ global $tester; $design = $tester->loadModel('design'); @@ -22,4 +29,4 @@ r($design->getPairs($productIDList[1], $types[0])) && p() && e('0'); r($design->getPairs($productIDList[1], $types[1])) && p('1') && e('1:这是一个设计1');//查询HLDS设计 r($design->getPairs($productIDList[1], $types[2])) && p('2') && e('2:这是一个设计2');//查询DDS设计 r($design->getPairs($productIDList[1], $types[3])) && p('3') && e('3:这是一个设计3');//查询DBDS设计 -r($design->getPairs($productIDList[1], $types[4])) && p('4') && e('4:这是一个设计4');//查询ADS设计 +r($design->getPairs($productIDList[1], $types[4])) && p('4') && e('4:这是一个设计4');//查询ADS设计 \ No newline at end of file diff --git a/test/model/design/printassignedhtml.php b/test/model/design/printassignedhtml.php deleted file mode 100644 index 3a4a9f749f..0000000000 --- a/test/model/design/printassignedhtml.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -printAssignedHtml(); -cid=1 -pid=1 - -*/ - -$design = new designTest(); - -r($design->printAssignedHtmlTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/design/setmenu.php b/test/model/design/setmenu.php deleted file mode 100644 index f903541df6..0000000000 --- a/test/model/design/setmenu.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setMenu(); -cid=1 -pid=1 - -*/ - -$design = new designTest(); - -r($design->setMenuTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/design/update.php b/test/model/design/update.php old mode 100644 new mode 100755 index 95e5386b32..c5823cc406 --- a/test/model/design/update.php +++ b/test/model/design/update.php @@ -10,6 +10,14 @@ title=测试 designModel->update(); cid=1 pid=1 +修改设计类型 >> type,HLDS,DDS +修改设计需求 >> story,0,17 +修改设计产品 >> product,31,21 +修改设计名称 >> name,这是一个设计1,修改设计 +修改设计详情 >> desc,这是设计描述1,详情修改 +设计名称不能为空 >> 『设计名称』不能为空。 +设计类型不能为空 >> 『设计类型』不能为空。 + */ $designIDList = array('1', '2', '3'); @@ -31,4 +39,4 @@ r($design->updateTest($designIDList[0],$updateDesc)) && p('0:field,old,new') r($design->updateTest($designIDList[0],$noName)) && p('name:0') && e('『设计名称』不能为空。'); //设计名称不能为空 r($design->updateTest($designIDList[0],$noType)) && p('type:0') && e('『设计类型』不能为空。'); //设计类型不能为空 -system("./ztest init"); +system("./ztest init"); \ No newline at end of file diff --git a/test/model/personnel/addwhitelist.php b/test/model/personnel/addwhitelist.php new file mode 100644 index 0000000000..ee45a7b2eb --- /dev/null +++ b/test/model/personnel/addwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +addWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->addWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/buildsearchform.php b/test/model/personnel/buildsearchform.php new file mode 100644 index 0000000000..edcd239213 --- /dev/null +++ b/test/model/personnel/buildsearchform.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +buildSearchForm(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->buildSearchFormTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/canviewprogram.php b/test/model/personnel/canviewprogram.php new file mode 100755 index 0000000000..5cae45f2e1 --- /dev/null +++ b/test/model/personnel/canviewprogram.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +canViewProgram(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest('admin'); + +$propramID = array(); +$programID[0] = 1; + +$account = array(); +$account[0] = 'test2'; + +r($personnel->canViewProgramTest(1, 'test2')) && p() && e('1'); //看是否具有访问权限有的情况 +r($personnel->canViewProgramTest(10000, 'test2')) && p() && e('1'); //看是否具有访问权限no的情况 diff --git a/test/model/personnel/creatememberlink.php b/test/model/personnel/creatememberlink.php new file mode 100644 index 0000000000..c991ed8e18 --- /dev/null +++ b/test/model/personnel/creatememberlink.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +createMemberLink(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->createMemberLinkTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/deleteexecutionwhitelist.php b/test/model/personnel/deleteexecutionwhitelist.php new file mode 100644 index 0000000000..3d9cdc899a --- /dev/null +++ b/test/model/personnel/deleteexecutionwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +deleteExecutionWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->deleteExecutionWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/deleteproductwhitelist.php b/test/model/personnel/deleteproductwhitelist.php new file mode 100644 index 0000000000..999f5735d8 --- /dev/null +++ b/test/model/personnel/deleteproductwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +deleteProductWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->deleteProductWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/deleteprogramwhitelist.php b/test/model/personnel/deleteprogramwhitelist.php new file mode 100644 index 0000000000..62b756d600 --- /dev/null +++ b/test/model/personnel/deleteprogramwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +deleteProgramWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->deleteProgramWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/deleteprojectwhitelist.php b/test/model/personnel/deleteprojectwhitelist.php new file mode 100644 index 0000000000..9ef63d7cf4 --- /dev/null +++ b/test/model/personnel/deleteprojectwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +deleteProjectWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->deleteProjectWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/deletewhitelist.php b/test/model/personnel/deletewhitelist.php new file mode 100644 index 0000000000..f3e767a268 --- /dev/null +++ b/test/model/personnel/deletewhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +deleteWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->deleteWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getaccessiblepersonnel.php b/test/model/personnel/getaccessiblepersonnel.php new file mode 100755 index 0000000000..43024dcef0 --- /dev/null +++ b/test/model/personnel/getaccessiblepersonnel.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +getAccessiblePersonnel(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest('admin'); + +$programID = array(); +$programID[0] = 1; +$programID[1] = 2; + +$deptID = array(); +$deptID[0] = 11; +$deptID[1] = 12; + +$browseType = array(); +$browseType[0] = 'all'; +$browseType[1] = 'bysearch'; + +$queryID = array(); +$browseType[0] = 1; + +$getrealname1 = $personnel->getAccessiblePersonnelTest($programID[0], $deptID[0], $browseType[0], $browseType[0])[101]; +$getnumber1 = count($personnel->getAccessiblePersonnelTest($programID[0], $deptID[0], $browseType[0], $browseType[0])); + +$getrealname2 = $personnel->getAccessiblePersonnelTest($programID[1], $deptID[1], $browseType[0], $browseType[0])[111]; +$getnumber2 = count($personnel->getAccessiblePersonnelTest($programID[1], $deptID[1], $browseType[0], $browseType[0])); + +r($getrealname1) && p('realname') && e('测试1'); //测试取出结果集中的一个对象里的名字programID=1 +r($getnumber1) && p() && e('10'); //测试取出匹配的数量 +r($getrealname2) && p('realname') && e('开发11'); //测试取出结果集中的一个对象里的名字programID=2 +r($getnumber2) && p() && e('10'); //测试取出匹配的数量 diff --git a/test/model/personnel/getbugandstoryinvest.php b/test/model/personnel/getbugandstoryinvest.php new file mode 100644 index 0000000000..f31002d347 --- /dev/null +++ b/test/model/personnel/getbugandstoryinvest.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getBugAndStoryInvest(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getBugAndStoryInvestTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getcopiedobjects.php b/test/model/personnel/getcopiedobjects.php new file mode 100644 index 0000000000..698551d7cb --- /dev/null +++ b/test/model/personnel/getcopiedobjects.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getCopiedObjects(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getCopiedObjectsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getinvest.php b/test/model/personnel/getinvest.php new file mode 100755 index 0000000000..4ab1075f40 --- /dev/null +++ b/test/model/personnel/getinvest.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +getInvest(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest('admin'); + +$programID = array(); +$programID[0] = 1; +$programID[1] = 2; + +$invest1 = count($personnel->getInvestTest($programID[0])); +$invest2 = count($personnel->getInvestTest($programID[1])); + +r($invest1) && p($invest1) && e(''); //获得项目id=1的授权用户数量 +r($invest2) && p($invest2) && e(''); //获得项目id=2的授权用户数量 diff --git a/test/model/personnel/getinvolvedexecutions.php b/test/model/personnel/getinvolvedexecutions.php new file mode 100755 index 0000000000..1f7f6ec81d --- /dev/null +++ b/test/model/personnel/getinvolvedexecutions.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getInvolvedExecutions(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest('admin'); + +$project = array(); +$project[0] = 101; +$project[1] = 102; + +r($personnel->getInvolvedExecutionsTest($project)) && p() && e(''); // diff --git a/test/model/personnel/getinvolvedprojects.php b/test/model/personnel/getinvolvedprojects.php new file mode 100644 index 0000000000..d1b7d1357e --- /dev/null +++ b/test/model/personnel/getinvolvedprojects.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getInvolvedProjects(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getInvolvedProjectsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getissueinvest.php b/test/model/personnel/getissueinvest.php new file mode 100644 index 0000000000..2cda93661f --- /dev/null +++ b/test/model/personnel/getissueinvest.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getIssueInvest(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getIssueInvestTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getprojecttaskinvest.php b/test/model/personnel/getprojecttaskinvest.php new file mode 100644 index 0000000000..691c956177 --- /dev/null +++ b/test/model/personnel/getprojecttaskinvest.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getProjectTaskInvest(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getProjectTaskInvestTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getriskinvest.php b/test/model/personnel/getriskinvest.php new file mode 100755 index 0000000000..8abe2503b6 --- /dev/null +++ b/test/model/personnel/getriskinvest.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getRiskInvest(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest('admin'); + +var_dump($personnel->getRiskInvestTest(array('test2', 'test3'), array(1, 2, 3)));die; + +r($personnel->getRiskInvestTest()) && p() && e(); diff --git a/test/model/personnel/getsprintandstage.php b/test/model/personnel/getsprintandstage.php new file mode 100644 index 0000000000..ad77fac728 --- /dev/null +++ b/test/model/personnel/getsprintandstage.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getSprintAndStage(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getSprintAndStageTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getuserefforthours.php b/test/model/personnel/getuserefforthours.php new file mode 100644 index 0000000000..ebac34ab07 --- /dev/null +++ b/test/model/personnel/getuserefforthours.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getUserEffortHours(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getUserEffortHoursTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getuserhours.php b/test/model/personnel/getuserhours.php new file mode 100644 index 0000000000..a134a1fd95 --- /dev/null +++ b/test/model/personnel/getuserhours.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getUserHours(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getUserHoursTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getwhitelist.php b/test/model/personnel/getwhitelist.php new file mode 100644 index 0000000000..5d2f1e51ca --- /dev/null +++ b/test/model/personnel/getwhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/getwhitelistaccount.php b/test/model/personnel/getwhitelistaccount.php new file mode 100644 index 0000000000..d1d2eed402 --- /dev/null +++ b/test/model/personnel/getwhitelistaccount.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +getWhitelistAccount(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->getWhitelistAccountTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/personnel/updatewhitelist.php b/test/model/personnel/updatewhitelist.php new file mode 100644 index 0000000000..b513f5c90a --- /dev/null +++ b/test/model/personnel/updatewhitelist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +updateWhitelist(); +cid=1 +pid=1 + +*/ + +$personnel = new personnelTest(); + +r($personnel->updateWhitelistTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/testcase/batchcreate.php b/test/model/testcase/batchcreate.php new file mode 100755 index 0000000000..f6857731fa --- /dev/null +++ b/test/model/testcase/batchcreate.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +batchCreate(); +cid=1 +pid=1 + +*/ + +$title1 = array('测试批量创建4', '', '测试批量创建6'); +$title2 = array('测试批量创建7', '测试批量创建8', '测试批量创建9'); +$title3 = array('测试批量创建10', '测试批量创建11', '测试批量创建12'); +$title4 = array('测试批量创建13', '测试批量创建14', '测试批量创建15'); +$title5 = array('测试批量创建16', '测试批量创建17', '测试批量创建18'); +$type = array('feature', 'ditto', 'config'); +$pri = array('2', 'ditto', '1'); +$stage = array(array('system', 'smoke'), array('bvt'), array('unittest')); +$needReview = array(0, 1, 0); + + +$testcase = new testcaseTest(); + +r($testcase->batchCreateTest(array('title' => $title1))) && p() && e('2'); // 测试批量创建用例1 +r($testcase->batchCreateTest(array('type' => $type, 'title' => $title2))) && p() && e('3'); // 测试批量创建用例2 +r($testcase->batchCreateTest(array('pri' => $pri, 'title' => $title3))) && p() && e('3'); // 测试批量创建用例3 +r($testcase->batchCreateTest(array('stage' => $stage, 'title' => $title4))) && p() && e('3'); // 测试批量创建用例4 +r($testcase->batchCreateTest(array('needReview' => $needReview, 'title' => $title5))) && p() && e('3'); // 测试批量创建用例5 +r($testcase->batchCreateTest(array('title' => $title1))) && p() && e('0'); // 测试重复批量创建用例1 +system("./ztest init"); diff --git a/test/model/testcase/batchupdate.php b/test/model/testcase/batchupdate.php new file mode 100755 index 0000000000..c41c261b53 --- /dev/null +++ b/test/model/testcase/batchupdate.php @@ -0,0 +1,47 @@ +#!/usr/bin/env php +batchUpdate(); +cid=1 +pid=1 + +*/ + +$changeTitle = array('1' => '修改后的测试用例1', '2' => '这个是测试用例2', '3' => '这个是测试用例3', '4' => '这个是测试用例4');; +$changePris = array('1' => 1, '2' => 1, '3' => 3, '4' => 4); +$changeStatuses = array('1' => 'wait', '2' => 'normal', '3' => 'nomal', '4' => 'investigate'); +$changeModules = array('1' => 0, '2' => 0, '3' => 0, '4' => 1822); +$changeColor = array('1' => '#2dbdb2', '2' => '#75c941', '3' => '#2dbdb2', '4' => '#797ec9'); +$changeTypes = array('1' => 'feature', '2' => 'other', '3' => 'config', '4' => 'install'); +$changePrecondition = array('1' => '这是前置条件1', '2' => '这是前置条件2', '3' => '修改后的前置条件3', '4' => '这是前置条件4'); +$changeKeywords = array('1' => '这是关键词1', '2' => '这是关键词2', '3' => '这是关键词3', '4' => '修改后的关键词4'); +$changeStages = array('1' => array('unittest', 'feature'), '2' => array('feature'), '3' => array('intergrate'), '4' => array('system')); + +$changeTitle = array('title' => $changeTitle); +$changePris = array('pris' => $changePris); +$changeStatuses = array('statuses' => $changeStatuses); +$changeModules = array('modules' => $changeModules); +$changeColor = array('color' => $changeColor); +$changeTypes = array('types' => $changeTypes); +$changePrecondition = array('precondition' => $changePrecondition); +$changeKeywords = array('keywords' => $changeKeywords); +$changeStages = array('stages' => $changeStages); + + +$testcase = new testcaseTest(); + +r($testcase->batchUpdateTest(1, $changeTitle)) && p('field,old,new') && e('title,这个是测试用例1,修改后的测试用例1'); // 测试批量修改用例标题 +r($testcase->batchUpdateTest(2, $changePris)) && p('field,old,new') && e('pri,2,1'); // 测试批量修改用例优先级 +r($testcase->batchUpdateTest(3, $changeStatuses)) && p('field,old,new') && e('status,blocked,nomal'); // 测试批量修改用例状态 +r($testcase->batchUpdateTest(4, $changeModules)) && p('field,old,new') && e('module,0,1822'); // 测试批量修改用例模块 +r($testcase->batchUpdateTest(1, $changeColor)) && p('field,old,new') && e('color,#3da7f5,#2dbdb2'); // 测试批量修改用例颜色 +r($testcase->batchUpdateTest(2, $changeTypes)) && p('field,old,new') && e('type,performance,other'); // 测试批量修改用例类型 +r($testcase->batchUpdateTest(3, $changePrecondition)) && p('field,old,new') && e('precondition,这是前置条件3,修改后的前置条件3'); // 测试批量修改用例前置条件 +r($testcase->batchUpdateTest(4, $changeKeywords)) && p('field,old,new') && e('keywords,这是关键词4,修改后的关键词4'); // 测试批量修改用例关键词 +r($testcase->batchUpdateTest(1, $changeStages)) && p('field,old,new') && e('stage,unittest,unittest,feature'); // 测试批量修改用例阶段 +system("./ztest init"); diff --git a/test/model/testcase/create.php b/test/model/testcase/create.php new file mode 100755 index 0000000000..84f17b9b86 --- /dev/null +++ b/test/model/testcase/create.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$testcase1 = array('title' => '测试创建测试用例1'); +$testcase2 = array('title' => '测试创建测试用例2', 'pri' => '1', 'type' => 'performance'); +$testcase3 = array('title' => '测试创建测试用例3', 'keywords' => '测试关键词3', 'stage' => array('unittest', 'smoke')); + +$no_title = array('title' => ''); +$no_type = array('type' => '', 'title' => '测试创建没有填写类型的用例'); + + + +$testcase = new testcaseTest(); + +r($testcase->createTest($testcase1)) && p('status') && e('created'); // 测试创建用例1 +r($testcase->createTest($testcase2)) && p('status') && e('created'); // 测试创建用例2 +r($testcase->createTest($testcase3)) && p('status') && e('created'); // 测试创建用例3 +r($testcase->createTest($testcase1)) && p('status') && e('exists'); // 测试创建重名用例1 +r($testcase->createTest($no_title)) && p() && e('『用例标题』不能为空。'); // 测试创建没有填写名字的用例 +r($testcase->createTest($no_type)) && p() && e('『用例类型』不能为空。'); // 测试创建没有填写类型的用例 +system("./ztest init"); diff --git a/test/model/testcase/createfromimport.php b/test/model/testcase/createfromimport.php new file mode 100755 index 0000000000..0f47224321 --- /dev/null +++ b/test/model/testcase/createfromimport.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +createFromImport(); +cid=1 +pid=1 + +*/ + +$productID = 1; + +$param1 = array('id' => array('1' => 1, '2' => 2), 'title' => array('1' => '导入覆盖的用例1', '2' => '导入覆盖的用例2'), 'insert' => '0'); +$param2 = array('id' => array('1' => 1, '2' => 2), 'title' => array('1' => '导入插入的用例1', '2' => '导入插入的用例2'), 'insert' => '1'); + +$testcase = new testcaseTest(); + +r($testcase->createFromImportTest($productID)) && p() && e('这个是测试用例1,这个是测试用例2,导入测试用例1,导入测试用例2'); // 测试直接导入数据 +r($testcase->createFromImportTest($productID, $param1)) && p() && e('导入覆盖的用例1,导入覆盖的用例2,导入测试用例1,导入测试用例2'); // 测试导入数据覆盖原有数据 +r($testcase->createFromImportTest($productID, $param2)) && p() && e('导入覆盖的用例1,导入覆盖的用例2,导入测试用例1,导入测试用例2,导入插入的用例1,导入插入的用例2'); // 测试导入数据不覆盖原有数据 +system("./ztest init"); diff --git a/test/model/testcase/getstatus.php b/test/model/testcase/getstatus.php new file mode 100755 index 0000000000..63721cd77c --- /dev/null +++ b/test/model/testcase/getstatus.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getStatus(); +cid=1 +pid=1 + +*/ + +$typeList = array('create', 'review', 'update'); + +$case1 = new stdclass(); +$case1->status = 'pass'; + +$case2 = new stdclass(); +$case2->status = 'clarify'; + +$case = null; +$param1 = array('lastEditedDate' => '2022-03-04 00:00:00'); + +$testcase = new testcaseTest(); + +r($testcase->getStatusTest($typeList[0])) && p() && e('normal'); // 测试获取create的状态 +r($testcase->getStatusTest($typeList[1], $case1)) && p() && e('pass'); // 测试获取review pass 的状态 +r($testcase->getStatusTest($typeList[1], $case2)) && p() && e('clarify'); // 测试获取review clarify 的状态 +r($testcase->getStatusTest($typeList[2], $case)) && p('1') && e('wait'); // 测试获取update的状态 +r($testcase->getStatusTest($typeList[2], $case, $param1)) && p() && e('该记录可能已经被改动。请刷新页面重新编辑!'); // 测试获取update 别人变更 的状态 diff --git a/test/model/testcase/gettestcases.php b/test/model/testcase/gettestcases.php new file mode 100755 index 0000000000..aaf5649a36 --- /dev/null +++ b/test/model/testcase/gettestcases.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +getTestCases(); +cid=1 +pid=1 + +*/ + +$productID = array('1', '2', '3', '4', '5'); +$browseType = array('all', 'wait', 'bymodule', 'needconfirm', 'bysuite'); +$suiteID = array('1', '3', '5', '7', '9'); + +$testcase = new testcaseTest(); + +r($testcase->getTestCasesTest($productID[0], $browseType[0], $suiteID[0])) && p('1:title;2:title;3:title;4:title') && e('这个是测试用例1;这个是测试用例2;这个是测试用例3;这个是测试用例4'); // 测试查询产品1 suiteID 1 browseType all 的测试用例 +r($testcase->getTestCasesTest($productID[0], $browseType[1], $suiteID[0])) && p('1:title') && e('这个是测试用例1'); // 测试查询产品1 suiteID 1 browseType wait 的测试用例 +r($testcase->getTestCasesTest($productID[0], $browseType[2], $suiteID[0])) && p('1:title;2:title;3:title;4:title') && e('这个是测试用例1;这个是测试用例2;这个是测试用例3;这个是测试用例4'); // 测试查询产品1 suiteID 1 browseType bymodule 的测试用例 +r($testcase->getTestCasesTest($productID[0], $browseType[3], $suiteID[0])) && p('0:title;1:title;2:title;3:title') && e('这个是测试用例4;这个是测试用例3;这个是测试用例2;这个是测试用例1'); // 测试查询产品1 suiteID 1 browseType needconfirm 的测试用例 +r($testcase->getTestCasesTest($productID[0], $browseType[4], $suiteID[0])) && p('1:title;2:title') && e('这个是测试用例1;这个是测试用例2'); // 测试查询产品1 suiteID 1 browseType bysuite 的测试用例 +r($testcase->getTestCasesTest($productID[1], $browseType[0], $suiteID[1])) && p('5:title;6:title;7:title;8:title') && e('这个是测试用例5;这个是测试用例6;这个是测试用例7;这个是测试用例8'); // 测试查询产品2 suiteID 3 browseType all 的测试用例 +r($testcase->getTestCasesTest($productID[1], $browseType[1], $suiteID[1])) && p('5:title') && e('这个是测试用例5'); // 测试查询产品2 suiteID 3 browseType wait 的测试用例 +r($testcase->getTestCasesTest($productID[1], $browseType[2], $suiteID[1])) && p('5:title;6:title;7:title;8:title') && e('这个是测试用例5;这个是测试用例6;这个是测试用例7;这个是测试用例8'); // 测试查询产品2 suiteID 3 browseType bymodule 的测试用例 +r($testcase->getTestCasesTest($productID[1], $browseType[3], $suiteID[1])) && p('0:title;1:title;2:title;3:title') && e('这个是测试用例8;这个是测试用例7;这个是测试用例6;这个是测试用例5'); // 测试查询产品2 suiteID 3 browseType needconfirm 的测试用例 +r($testcase->getTestCasesTest($productID[1], $browseType[4], $suiteID[1])) && p('5:title;6:title') && e('这个是测试用例5;这个是测试用例6'); // 测试查询产品2 suiteID 3 browseType bysuite 的测试用例 +r($testcase->getTestCasesTest($productID[2], $browseType[0], $suiteID[2])) && p('9:title;10:title;11:title;12:title') && e('这个是测试用例9;这个是测试用例10;这个是测试用例11;这个是测试用例12'); // 测试查询产品3 suiteID 5 browseType all 的测试用例 +r($testcase->getTestCasesTest($productID[2], $browseType[1], $suiteID[2])) && p('9:title') && e('这个是测试用例9'); // 测试查询产品3 suiteID 5 browseType wait 的测试用例 +r($testcase->getTestCasesTest($productID[2], $browseType[2], $suiteID[2])) && p('9:title;10:title;11:title;12:title') && e('这个是测试用例9;这个是测试用例10;这个是测试用例11;这个是测试用例12'); // 测试查询产品3 suiteID 5 browseType bymodule 的测试用例 +r($testcase->getTestCasesTest($productID[2], $browseType[3], $suiteID[2])) && p('0:title;1:title;2:title;3:title') && e('这个是测试用例12;这个是测试用例11;这个是测试用例10;这个是测试用例9'); // 测试查询产品3 suiteID 5 browseType needconfirm 的测试用例 +r($testcase->getTestCasesTest($productID[2], $browseType[4], $suiteID[2])) && p('9:title;10:title') && e('这个是测试用例9;这个是测试用例10'); // 测试查询产品3 suiteID 5 browseType bysuite 的测试用例 +r($testcase->getTestCasesTest($productID[3], $browseType[0], $suiteID[3])) && p('13:title;14:title;15:title;16:title') && e('这个是测试用例13;这个是测试用例14;这个是测试用例15;这个是测试用例16'); // 测试查询产品4 suiteID 7 browseType all 的测试用例 +r($testcase->getTestCasesTest($productID[3], $browseType[1], $suiteID[3])) && p('13:title') && e('这个是测试用例13'); // 测试查询产品4 suiteID 7 browseType wait 的测试用例 +r($testcase->getTestCasesTest($productID[3], $browseType[2], $suiteID[3])) && p('13:title;14:title;15:title;16:title') && e('这个是测试用例13;这个是测试用例14;这个是测试用例15;这个是测试用例16'); // 测试查询产品4 suiteID 7 browseType bymodule 的测试用例 +r($testcase->getTestCasesTest($productID[3], $browseType[3], $suiteID[3])) && p('0:title;1:title;2:title;3:title') && e('这个是测试用例16;这个是测试用例15;这个是测试用例14;这个是测试用例13'); // 测试查询产品4 suiteID 7 browseType needconfirm 的测试用例 +r($testcase->getTestCasesTest($productID[3], $browseType[4], $suiteID[3])) && p('13:title;14:title') && e('这个是测试用例13;这个是测试用例14'); // 测试查询产品4 suiteID 7 browseType bysuite 的测试用例 +r($testcase->getTestCasesTest($productID[4], $browseType[0], $suiteID[4])) && p('17:title;18:title;19:title;20:title') && e('这个是测试用例17;这个是测试用例18;这个是测试用例19;这个是测试用例20'); // 测试查询产品5 suiteID 9 browseType all 的测试用例 +r($testcase->getTestCasesTest($productID[4], $browseType[1], $suiteID[4])) && p('17:title') && e('这个是测试用例17'); // 测试查询产品5 suiteID 9 browseType wait 的测试用例 +r($testcase->getTestCasesTest($productID[4], $browseType[2], $suiteID[4])) && p('17:title;18:title;19:title;20:title') && e('这个是测试用例17;这个是测试用例18;这个是测试用例19;这个是测试用例20'); // 测试查询产品5 suiteID 9 browseType bymodule 的测试用例 +r($testcase->getTestCasesTest($productID[4], $browseType[3], $suiteID[4])) && p('0:title;1:title;2:title;3:title') && e('这个是测试用例20;这个是测试用例19;这个是测试用例18;这个是测试用例17'); // 测试查询产品5 suiteID 9 browseType needconfirm 的测试用例 +r($testcase->getTestCasesTest($productID[4], $browseType[4], $suiteID[4])) && p('17:title;18:title') && e('这个是测试用例17;这个是测试用例18'); // 测试查询产品5 suiteID 9 browseType bysuite 的测试用例 diff --git a/test/model/testcase/importfromlib.php b/test/model/testcase/importfromlib.php new file mode 100755 index 0000000000..8d4871d39f --- /dev/null +++ b/test/model/testcase/importfromlib.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +importFromLib(); +cid=1 +pid=1 + +*/ + +$productID = 1; +$caseIdList = array(array('401' => '401', '402' => '402'), array('403' => '403', '404' => '404'), array('405' => '405', '406' => '406'), array('407' => '407', '408' => '408'), array('409' => '409', '410' => '410')); + +$testcase = new testcaseTest(); + +r($testcase->importFromLibTest($productID, $caseIdList[0])) && p('0:title;1:title') && e('用例库用例1;用例库用例2'); // 测试导入用例库用例 401 402 +r($testcase->importFromLibTest($productID, $caseIdList[1])) && p('0:title;1:title') && e('用例库用例3;用例库用例4'); // 测试导入用例库用例 403 404 +r($testcase->importFromLibTest($productID, $caseIdList[2])) && p('0:title;1:title') && e('用例库用例5;用例库用例6'); // 测试导入用例库用例 405 406 +r($testcase->importFromLibTest($productID, $caseIdList[3])) && p('0:title;1:title') && e('用例库用例7;用例库用例8'); // 测试导入用例库用例 407 408 +r($testcase->importFromLibTest($productID, $caseIdList[4])) && p('0:title;1:title') && e('用例库用例9;用例库用例10'); // 测试导入用例库用例 409 410 +system("./ztest init"); diff --git a/test/model/testcase/joinstep.php b/test/model/testcase/joinstep.php new file mode 100755 index 0000000000..00240da386 --- /dev/null +++ b/test/model/testcase/joinstep.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +joinStep(); +cid=1 +pid=1 + +*/ + +$stepIDList = array('1,2', '3,4', '5,6', '7,8', '9,10'); + +$testcase = new testcaseTest(); + +r($testcase->joinStepTest($stepIDList[0])) && p() && e('用例步骤描述1 EXPECT:这是用例预期结果1 用例步骤描述2 EXPECT:这是用例预期结果2'); // 测试获取步骤 1 2 的字符串 +r($testcase->joinStepTest($stepIDList[1])) && p() && e('用例步骤描述3 EXPECT:这是用例预期结果3 用例步骤描述4 EXPECT:这是用例预期结果4'); // 测试获取步骤 3 4 的字符串 +r($testcase->joinStepTest($stepIDList[2])) && p() && e('用例步骤描述5 EXPECT:这是用例预期结果5 用例步骤描述6 EXPECT:这是用例预期结果6'); // 测试获取步骤 5 6 的字符串 +r($testcase->joinStepTest($stepIDList[3])) && p() && e('用例步骤描述7 EXPECT:这是用例预期结果7 用例步骤描述8 EXPECT:这是用例预期结果8'); // 测试获取步骤 7 8 的字符串 +r($testcase->joinStepTest($stepIDList[4])) && p() && e('用例步骤描述9 EXPECT:这是用例预期结果9 用例步骤描述10 EXPECT:这是用例预期结果10'); // 测试获取步骤 9 10 的字符串 diff --git a/test/model/testcase/review.php b/test/model/testcase/review.php new file mode 100755 index 0000000000..24367cef64 --- /dev/null +++ b/test/model/testcase/review.php @@ -0,0 +1,49 @@ +#!/usr/bin/env php +review(); +cid=1 +pid=1 + +*/ + +$caseIDList = array(1, 5, 9, 13, 17); + +$case1 = new stdclass(); +$case1->result = 'pass'; +$case1->status = 'normal'; +$case1->reviewedBy = array('test1'); + +$case2 = new stdclass(); +$case2->result = 'clarify'; +$case2->status = 'wait'; +$case2->reviewedBy = array('test2'); + +$case3 = new stdclass(); +$case3->result = 'pass'; +$case3->status = 'normal'; +$case3->reviewedBy = array('test3'); + +$case4 = new stdclass(); +$case4->result = 'clarify'; +$case4->status = 'wait'; +$case4->reviewedBy = array('test4'); + +$case5 = new stdclass(); +$case5->result = 'pass'; +$case5->status = 'normal'; +$case5->reviewedBy = array('test5'); + +$testcase = new testcaseTest(); + +r($testcase->reviewTest($caseIDList[0], $case1)) && p('0:field,old,new') && e('status,wait,normal'); // 测试评审用例 1 +r($testcase->reviewTest($caseIDList[1], $case2)) && p('0:field,old,new') && e('reviewedBy,admin,test2'); // 测试评审用例 2 +r($testcase->reviewTest($caseIDList[2], $case3)) && p('0:field,old,new') && e('status,wait,normal'); // 测试评审用例 3 +r($testcase->reviewTest($caseIDList[3], $case4)) && p('0:field,old,new') && e('reviewedBy,admin,test4'); // 测试评审用例 4 +r($testcase->reviewTest($caseIDList[4], $case5)) && p('0:field,old,new') && e('status,wait,normal'); // 测试评审用例 5 +system("./ztest init"); diff --git a/test/model/testcase/synccase2project.php b/test/model/testcase/synccase2project.php new file mode 100755 index 0000000000..71a53dddfa --- /dev/null +++ b/test/model/testcase/synccase2project.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +syncCase2Project(); +cid=1 +pid=1 + +*/ + +$caseIDList = array(1, 5, 9, 13, 17, 2); + +$testcase = new testcaseTest(); + +r($testcase->syncCase2ProjectTest($caseIDList[0])) && p() && e('2'); // 测试同步用例 1 到关联项目中 +r($testcase->syncCase2ProjectTest($caseIDList[1])) && p() && e('2'); // 测试同步用例 2 到关联项目中 +r($testcase->syncCase2ProjectTest($caseIDList[2])) && p() && e('2'); // 测试同步用例 3 到关联项目中 +r($testcase->syncCase2ProjectTest($caseIDList[3])) && p() && e('2'); // 测试同步用例 4 到关联项目中 +r($testcase->syncCase2ProjectTest($caseIDList[4])) && p() && e('2'); // 测试同步用例 5 到关联项目中 +system("./ztest init"); diff --git a/test/model/testcase/update.php b/test/model/testcase/update.php new file mode 100755 index 0000000000..7fe154abc0 --- /dev/null +++ b/test/model/testcase/update.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$changeTitle = array('title' => '修改后的名称'); +$changePrecondition = array('precondition' => '修改后的前置条件'); +$changeStatus = array('status' => 'normal'); +$changePri = array('pri' => '3'); + +$testcase = new testcaseTest(); + +r($testcase->updateTest($changeTitle)) && p('0:field,old,new') && e('title,这个是测试用例1,修改后的名称'); // 测试修改标题 +r($testcase->updateTest($changeTitle)) && p('0:field,old,new') && e('没有数据更新'); // 测试重复修改标题 +r($testcase->updateTest($changePrecondition)) && p('0:field,old,new') && e('precondition,这是前置条件1,修改后的前置条件'); // 测试修改前置条件 +r($testcase->updateTest($changeStatus)) && p('0:field,old,new') && e('status,wait,normal'); // 测试修改状态 +r($testcase->updateTest($changePri)) && p('0:field,old,new') && e('pri,1,3'); // 测试修改优先级 +system("./ztest init"); diff --git a/test/model/testcase/updatecase2project.php b/test/model/testcase/updatecase2project.php new file mode 100755 index 0000000000..169881869b --- /dev/null +++ b/test/model/testcase/updatecase2project.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +updateCase2Project(); +cid=1 +pid=1 + +*/ + +$caseIDList = array('1', '3', '5', '7', '9'); +$objectTypeList = array('product', 'story'); +$objectIDList = array('2', '1', '6', '2'); + +$testcase = new testcaseTest(); + +r($testcase->updateCase2ProjectTest($caseIDList[0], $objectTypeList[0], $objectIDList[0])) && p('0:project,product,case') && e('101,2,1'); // 测试修改用例 1 产品 +r($testcase->updateCase2ProjectTest($caseIDList[0], $objectTypeList[1], $objectIDList[2])) && p('0:project,product,case;1:project,product,case;2:project,product,case') && e('101,2,1;12,1,1;102,1,1'); // 测试修改用例 1 需求 +r($testcase->updateCase2ProjectTest($caseIDList[1], $objectTypeList[0], $objectIDList[0])) && p('0:project,product,case') && e('101,2,3'); // 测试修改用例 3 产品 +r($testcase->updateCase2ProjectTest($caseIDList[1], $objectTypeList[1], $objectIDList[2])) && p('0:project,product,case;1:project,product,case;2:project,product,case') && e('101,2,3;12,1,3;102,1,3'); // 测试修改用例 3 需求 +r($testcase->updateCase2ProjectTest($caseIDList[2], $objectTypeList[0], $objectIDList[1])) && p('0:project,product,case') && e('102,1,5'); // 测试修改用例 5 产品 +r($testcase->updateCase2ProjectTest($caseIDList[2], $objectTypeList[1], $objectIDList[3])) && p('0:project,product,case;1:project,product,case;2:project,product,case') && e('102,1,5;11,2,5;101,2,5'); // 测试修改用例 5 需求 +r($testcase->updateCase2ProjectTest($caseIDList[3], $objectTypeList[0], $objectIDList[1])) && p('0:project,product,case') && e('102,1,7'); // 测试修改用例 7 产品 +r($testcase->updateCase2ProjectTest($caseIDList[3], $objectTypeList[1], $objectIDList[3])) && p('0:project,product,case;1:project,product,case;2:project,product,case') && e('102,1,7;11,2,7;101,2,7'); // 测试修改用例 7 需求 +r($testcase->updateCase2ProjectTest($caseIDList[4], $objectTypeList[0], $objectIDList[1])) && p('0:project,product,case') && e('103,1,9'); // 测试修改用例 9 产品 +r($testcase->updateCase2ProjectTest($caseIDList[4], $objectTypeList[1], $objectIDList[3])) && p('0:project,product,case;1:project,product,case;2:project,product,case') && e('103,1,9;11,3,9;101,3,9'); // 测试修改用例 9 需求 +system("./ztest init"); diff --git a/test/ztest b/test/ztest index 156a8839c3..121b61ec45 100755 --- a/test/ztest +++ b/test/ztest @@ -73,6 +73,9 @@ switch($argv[1]) case 'cron': ztfRun('model/cron'); break; + case 'design': + ztfRun('model/design'); + break; case 'model': ztfRun('model'); break;