From 9700d0fb4cec99c5890e2e02ecdab49e4192848c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 15 Apr 2025 17:11:55 +0800 Subject: [PATCH 01/26] * [refac bug #61503] disable sort btn for ipd. --- module/programplan/js/create.ui.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/programplan/js/create.ui.js b/module/programplan/js/create.ui.js index 965efd4577..a308e98de6 100644 --- a/module/programplan/js/create.ui.js +++ b/module/programplan/js/create.ui.js @@ -212,8 +212,11 @@ window.handleRenderRow = function($row, index, data) if(project.model == 'ipd') { - if(planID == 0) $row.find('[data-name="ACTIONS"]').find('[data-type="sort"]').addClass('hidden'); - if(level == 0 && planID == 0) $row.find('[data-name="ACTIONS"]').find('[data-type="addSibling"]').addClass('disabled').prop('disabled', true); + if(planID == 0 && level == 0) + { + $row.find('[data-name="ACTIONS"]').find('[data-type="sort"]').addClass('disabled').prop('disabled', true); + $row.find('[data-name="ACTIONS"]').find('[data-type="addSibling"]').addClass('disabled').prop('disabled', true); + } $row.find('[data-name="attribute"]').find('.picker-box').on('inited', function(e, info){ info[0].render({disabled: true}); }); From a60f95759f95dbf835eaa6b59521da6289bf8b92 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Apr 2025 08:47:41 +0800 Subject: [PATCH 02/26] * [refac bug #61271] Adjust code for click sub stage button. --- module/programplan/ui/create.html.php | 2 +- module/project/ui/execution.html.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/programplan/ui/create.html.php b/module/programplan/ui/create.html.php index 8ff1518fcb..4dc7d578c9 100644 --- a/module/programplan/ui/create.html.php +++ b/module/programplan/ui/create.html.php @@ -59,7 +59,7 @@ $fnGenerateStageByProductList = function() use ($productID, $productList, $proje }; /* Generate checkboxes for sub-stage management. */ -$fnGenerateSubPlanManageFields = function() use ($lang, $planID, $project, $executionType, $canParallel) +$fnGenerateSubPlanManageFields = function() use ($lang, $planID, $project, $canParallel) { if(!(empty($planID) && $project->model == 'ipd')) return div(); diff --git a/module/project/ui/execution.html.php b/module/project/ui/execution.html.php index 2334b57284..a0f653e7f3 100644 --- a/module/project/ui/execution.html.php +++ b/module/project/ui/execution.html.php @@ -60,8 +60,8 @@ if($canBatchAction) $fieldList = $config->project->execution->dtable->fieldList; $fieldList['status']['statusMap']['changed'] = $lang->task->storyChange; -/* waterfall & waterfallplus model with different edit link. */ -if(in_array($project->model, array('waterfall', 'waterfallplus'))) +/* waterfall & waterfallplus & ipd model with different edit link. */ +if(in_array($project->model, array('waterfall', 'waterfallplus', 'ipd'))) { $fieldList['actions']['actionsMap']['edit']['data-size'] = 'md'; $fieldList['actions']['actionsMap']['edit']['url'] = createLink('programplan', 'edit', "stageID={rawID}&projectID={projectID}"); From f31cd846a02ca99d1ef0a2b0cb4ad38345784ac3 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Wed, 16 Apr 2025 09:03:36 +0800 Subject: [PATCH 03/26] * [bug#61353,done,0.2h,0h] Add programplan relation lang. --- module/programplan/lang/de.php | 1 + module/programplan/lang/en.php | 1 + module/programplan/lang/fr.php | 1 + module/programplan/lang/zh-cn.php | 1 + 4 files changed, 4 insertions(+) diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index 6560fd5236..464c22e7a0 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -74,6 +74,7 @@ $lang->programplan->enabled = 'Enabling Stage'; $lang->programplan->point = 'Review Point'; $lang->programplan->progress = 'Progress'; +$lang->programplan->relation = 'Manage Task Relation'; $lang->programplan->setTaskRelation = 'Manage Task Relation'; $lang->programplan->viewTaskRelation = 'View Task Relation'; $lang->programplan->createRelation = 'Create Task Relation'; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 63c1615de7..09ef59d4fe 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -74,6 +74,7 @@ $lang->programplan->enabled = 'Enabling Stage'; $lang->programplan->point = 'Review Point'; $lang->programplan->progress = 'Progress'; +$lang->programplan->relation = 'Manage Task Relation'; $lang->programplan->setTaskRelation = 'Manage Task Relation'; $lang->programplan->viewTaskRelation = 'View Task Relation'; $lang->programplan->createRelation = 'Create Task Relation'; diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index b17178ba64..9ce00e7591 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -74,6 +74,7 @@ $lang->programplan->enabled = 'Enabling Stage'; $lang->programplan->point = 'Review Point'; $lang->programplan->progress = 'Progress'; +$lang->programplan->relation = 'Manage Task Relation'; $lang->programplan->setTaskRelation = 'Manage Task Relation'; $lang->programplan->viewTaskRelation = 'View Task Relation'; $lang->programplan->createRelation = 'Create Task Relation'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 3cc71018be..db29dcdfdf 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -74,6 +74,7 @@ $lang->programplan->enabled = '启用阶段'; $lang->programplan->point = '评审点'; $lang->programplan->progress = '进度'; +$lang->programplan->relation = '维护任务关系'; $lang->programplan->setTaskRelation = '维护任务关系'; $lang->programplan->viewTaskRelation = '浏览任务关系'; $lang->programplan->createRelation = '添加任务关系'; From ee13faa824bb067387bea53fe63635a49b7b4a5d Mon Sep 17 00:00:00 2001 From: wangyuting Date: Wed, 16 Apr 2025 09:35:09 +0800 Subject: [PATCH 04/26] * [bug#61381,0.4h,0h] Fix change 1.5 menu link error --- module/execution/zen.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/execution/zen.php b/module/execution/zen.php index e94c1b11b8..1f88c82b10 100644 --- a/module/execution/zen.php +++ b/module/execution/zen.php @@ -1648,6 +1648,10 @@ class executionZen extends execution { $link = helper::createLink('execution', 'testcase', "executionID=%s"); } + elseif($method == 'createrelation') + { + $link = helper::createLink('execution', 'relation', "executionID=%s"); + } if($type != '') $link .= "&type=$type"; return $link; From 01e122f8aef626c3ddd577e75ae7cac9507afcdb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Apr 2025 09:48:02 +0800 Subject: [PATCH 05/26] * [refac bug #61502] render attribute field for ipd. --- module/execution/js/batchedit.ui.js | 35 ++++++++++++++++---------- module/execution/ui/batchedit.html.php | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/module/execution/js/batchedit.ui.js b/module/execution/js/batchedit.ui.js index b6a3b5ec97..797d40033c 100644 --- a/module/execution/js/batchedit.ui.js +++ b/module/execution/js/batchedit.ui.js @@ -1,26 +1,35 @@ window.renderRowData = function($row, index, row) { - if((row.type == 'stage' || row.attribute != '') && stageList[row.attribute]) + let options = {}; + options.required = true; + + if(row.type == 'stage' || row.attribute != '') { + let itemList = []; + let projectModel = 'stage'; + if(stageList[row.attribute] !== undefined) itemList = stageList; + if(ipdTypeList[row.attribute] !== undefined) + { + itemList = ipdTypeList; + projectModel = 'ipd'; + } + const parentType = row.grade > 1 && parents[row.parent] ? parents[row.parent].attribute : ''; /* If is stage, modify lifetime to attribute. */ let stageItems = []; - for(let key in stageList) stageItems.push({value: key, text: stageList[key]}); + for(let key in itemList) stageItems.push({value: key, text: itemList[key]}); - $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) + if(stageItems.length > 0) { - let $attribute = info[0]; - $attribute.render({items: stageItems, required: true, name: 'attribute[' + row.id + ']', disabled: row.grade > 1 && parentType != 'mix'}); - $row.attr('data-parent', row.parent); - }); + options.items = stageItems; + options.name = 'attribute[' + row.id + ']'; + options.disabled = row.grade > 1 && parentType != 'mix'; + if(projectModel == 'ipd') options.disabled = true; + } + $row.attr('data-parent', row.parent); } - $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) - { - let $lifetime = info[0]; - $lifetime.render({required: true}); - }); - + $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) { info[0].render(options); }); $row.find('[data-name="project"]').attr('data-lastselected', row.project).attr('data-execution', row.id); } diff --git a/module/execution/ui/batchedit.html.php b/module/execution/ui/batchedit.html.php index f82a043e4f..f77ec53086 100644 --- a/module/execution/ui/batchedit.html.php +++ b/module/execution/ui/batchedit.html.php @@ -15,6 +15,7 @@ $showMethod = $app->tab == 'project' && isset($project) && ($project->model == ' jsVar('weekend', $config->execution->weekend); jsVar('stageList', $lang->stage->typeList); +jsVar('ipdTypeList', $lang->stage->ipdTypeList); jsVar('confirmSync', $lang->execution->confirmSync); jsVar('noticeChangeAttr', $lang->programplan->noticeChangeAttr); jsVar('parents', $parents); From 6d85bfab65f490d561f3d5bb972cad1981a42e69 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Apr 2025 10:09:13 +0800 Subject: [PATCH 06/26] * [refac bug #61526] Adjust for add sub stage. --- module/programplan/js/create.ui.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/module/programplan/js/create.ui.js b/module/programplan/js/create.ui.js index a308e98de6..cddd143ac4 100644 --- a/module/programplan/js/create.ui.js +++ b/module/programplan/js/create.ui.js @@ -21,27 +21,23 @@ window.handleClickBatchFormAction = function(action, $row, rowIndex) if(action == 'addSub' && $row.find('td[data-name="id"] input[name^=id]').val() > 0) { const $syncData = $row.find('td[data-name="syncData"] input[name^=syncData]'); - if(!$syncData.hasClass('confirmed') && $syncData.val() == '0') + if($syncData.val() == '0') { - if($syncData.hasClass('requested')) return window.clickToAddRow($this, action, $row, rowIndex); - - $syncData.addClass('requested'); const executionID = $row.find('td[data-name="id"] input[name^=id]').val(); $.get($.createLink('project', 'ajaxCheckHasStageData', `executionID=${executionID}`), function(hasData) { if(!hasData) return window.clickToAddRow($this, action, $row, rowIndex); - $syncData.addClass('confirmed'); zui.Modal.confirm(confirmCreateTip).then((res) => { - if(!res) return $row.find('td[data-name="ACTIONS"] [data-type="addSub"]').attr('disabled', 'disabled').addClass('disabled'); + if(!res) return; $syncData.val('1'); window.clickToAddRow($this, action, $row, rowIndex); }); }); } - else if($syncData.val() == '1') + else { window.clickToAddRow($this, action, $row, rowIndex); } From 3a8623046d0af00066dc221d1f269417486e5b5a Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Apr 2025 10:12:53 +0800 Subject: [PATCH 07/26] * [refac bug #61502] Adjust code. --- module/execution/js/batchedit.ui.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/execution/js/batchedit.ui.js b/module/execution/js/batchedit.ui.js index 797d40033c..9360903740 100644 --- a/module/execution/js/batchedit.ui.js +++ b/module/execution/js/batchedit.ui.js @@ -1,7 +1,6 @@ window.renderRowData = function($row, index, row) { - let options = {}; - options.required = true; + let options = {required: true}; if(row.type == 'stage' || row.attribute != '') { From 0751952bfba112fa044290ba113cc928d140aa20 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:50:16 +0800 Subject: [PATCH 08/26] * [ci,done,0.2h] add unit test for delete method. --- module/doc/test/model/delete.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 module/doc/test/model/delete.php diff --git a/module/doc/test/model/delete.php b/module/doc/test/model/delete.php new file mode 100644 index 0000000000..82ecbf862c --- /dev/null +++ b/module/doc/test/model/delete.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php +delete(); +cid=1 + +- 测试删除ID为0的文档 @0 +- 测试删除ID为1的文档 @1 +- 测试删除ID不存在的文档 @0 +- 测试删除表不是文档表且ID为0的文档 @0 +- 测试删除表不是文档表且ID不存在的文档 @0 + +*/ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php'; + +zenData('doc')->loadYaml('doc')->gen(10); +zenData('user')->gen(5); +su('admin'); + +$tableList = array(TABLE_DOC, TABLE_DOCLIB); +$docIdList = array(0, 1, 11); + +$docTester = new docTest(); +r($docTester->deleteTest($tableList[0], $docIdList[0])) && p() && e('0'); // 测试删除ID为0的文档 +r($docTester->deleteTest($tableList[0], $docIdList[1])) && p() && e('1'); // 测试删除ID为1的文档 +r($docTester->deleteTest($tableList[0], $docIdList[2])) && p() && e('0'); // 测试删除ID不存在的文档 +r($docTester->deleteTest($tableList[1], $docIdList[0])) && p() && e('0'); // 测试删除表不是文档表且ID为0的文档 +r($docTester->deleteTest($tableList[1], $docIdList[2])) && p() && e('0'); // 测试删除表不是文档表且ID不存在的文档 From 4d8d38040fdc11c5c959dcfe1a5dc4e0be1e94ab Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:51:07 +0800 Subject: [PATCH 09/26] * [ci,done,0.3h] add unit test for delete method. --- module/doc/model.php | 2 ++ module/doc/test/lib/doc.unittest.class.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/module/doc/model.php b/module/doc/model.php index 621aedf2f0..f3bd058979 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -3828,6 +3828,8 @@ class docModel extends model */ public function delete(string $table, int $id): bool { + if($table != TABLE_DOC) return false; + $this->dao->update($table)->set('deleted')->eq('1')->where('id')->eq($id)->exec(); $doc = $this->getByID($id); diff --git a/module/doc/test/lib/doc.unittest.class.php b/module/doc/test/lib/doc.unittest.class.php index e3f1ca0e62..8bb3fe14b6 100644 --- a/module/doc/test/lib/doc.unittest.class.php +++ b/module/doc/test/lib/doc.unittest.class.php @@ -1439,4 +1439,22 @@ class docTest return $this->objectModel->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->eq($docID)->andWhere('version')->eq($doc->version + 1)->fetch(); } + + /** + * 删除文档。 + * Delete document. + * + * @param string $table + * @param int $id + * @access public + * @return bool + */ + public function deleteTest(string $table, int $id): bool + { + $result = $this->objectModel->delete($table, $id); + if(!$result) return false; + + $deleted = $this->objectModel->dao->select('deleted')->from($table)->where('id')->eq($id)->fetch('deleted'); + return $deleted == 1; + } } From ee9ff4d8636588d02d874ffce3b3cc3049c06e24 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:01:10 +0800 Subject: [PATCH 10/26] + [unittest] add buildSearchFormTest. --- .../test/lib/testcase.unittest.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/testcase/test/lib/testcase.unittest.class.php b/module/testcase/test/lib/testcase.unittest.class.php index 8310d5eda7..870452c5cf 100755 --- a/module/testcase/test/lib/testcase.unittest.class.php +++ b/module/testcase/test/lib/testcase.unittest.class.php @@ -1911,4 +1911,23 @@ class testcaseTest return $tester->dao->select('*,IF(files = "", 0, files) as files')->from(TABLE_CASESPEC)->where('case')->eq($caseID)->andWhere('version')->eq($case->version)->fetch(); } + + /** + * 测试通过搜索获取执行用例。 + * Test get execution cases by search. + * + * @param int $productID + * @param int $projectID + * @param int $moduleID + * @param int|string $branchID + * @access public + * @return string + */ + public function buildSearchFormTest(int $productID, int $projectID, int $moduleID, int|string $branchID): string + { + $this->objectModel->buildSearchForm($productID, array(), 0, 'actionURL', $projectID, $moduleID, $branchID); + + global $tester; + return implode(',', array_keys($tester->config->testcase->search['fields'])); + } } From 8a9bb7b542db6ad275de110fd41fabb037549a6a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:03:19 +0800 Subject: [PATCH 11/26] + [unittest] add unit test of testcaseModel::buildSearchForm. --- .../testcase/test/model/buildsearchform.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 module/testcase/test/model/buildsearchform.php diff --git a/module/testcase/test/model/buildsearchform.php b/module/testcase/test/model/buildsearchform.php new file mode 100644 index 0000000000..ff9612c367 --- /dev/null +++ b/module/testcase/test/model/buildsearchform.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +gen('45'); +zenData('branch')->gen('10'); +zenData('project')->gen('30'); +zenData('story')->gen('10'); +zenData('module')->gen('10'); +zenData('user')->gen('1'); + +su('admin'); + +/** + +title=测试 testcaseModel->buildSearchForm(); +cid=1 +pid=1 + +*/ \ No newline at end of file From 1d39f5b911e79cdca659c99bcee65dac081a014d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:03:47 +0800 Subject: [PATCH 12/26] + [unittest] add unit test of testcaseModel::buildSearchForm. --- module/testcase/test/model/buildsearchform.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/module/testcase/test/model/buildsearchform.php b/module/testcase/test/model/buildsearchform.php index ff9612c367..1f69f688d2 100644 --- a/module/testcase/test/model/buildsearchform.php +++ b/module/testcase/test/model/buildsearchform.php @@ -18,4 +18,18 @@ title=测试 testcaseModel->buildSearchForm(); cid=1 pid=1 -*/ \ No newline at end of file +*/ + +$productID = array(0, 1, 41); +$projectID = array(0, 11); +$moduleID = array(0, 1); +$branch = array('all', 0); + +$testcase = new testcaseTest(); + +r($testcase->buildSearchFormTest($productID[0], $projectID[0], $moduleID[0], $branch[0])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene'); // 测试构建产品 0 project 0 module 0 branch all 的搜索表单 +r($testcase->buildSearchFormTest($productID[1], $projectID[0], $moduleID[0], $branch[0])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene'); // 测试构建产品 1 project 0 module 0 branch all 的搜索表单 +r($testcase->buildSearchFormTest($productID[1], $projectID[1], $moduleID[0], $branch[0])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene'); // 测试构建产品 1 project 1 module 0 branch all 的搜索表单 +r($testcase->buildSearchFormTest($productID[1], $projectID[1], $moduleID[1], $branch[0])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene'); // 测试构建产品 1 project 1 module 1 branch all 的搜索表单 +r($testcase->buildSearchFormTest($productID[2], $projectID[0], $moduleID[0], $branch[0])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene,branch'); // 测试构建产品 41 project 0 module 0 branch 0 的搜索表单 +r($testcase->buildSearchFormTest($productID[2], $projectID[0], $moduleID[0], $branch[1])) && p() && e('title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,product,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene,branch'); // 测试构建产品 41 project 0 module 0 branch 0 的搜索表单 \ No newline at end of file From 45ca3f2435a731e244a75d33ce7aa1908a7e0c7c Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:04:50 +0800 Subject: [PATCH 13/26] + [unittest] add unit test ymal. --- .../test/model/yaml/upgrademydocspace/doclib.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 module/upgrade/test/model/yaml/upgrademydocspace/doclib.yaml diff --git a/module/upgrade/test/model/yaml/upgrademydocspace/doclib.yaml b/module/upgrade/test/model/yaml/upgrademydocspace/doclib.yaml new file mode 100644 index 0000000000..8548d87848 --- /dev/null +++ b/module/upgrade/test/model/yaml/upgrademydocspace/doclib.yaml @@ -0,0 +1,12 @@ +title: table zt_doclib +author: Mengyi Liu +version: "1.0" +fields: + - field: id + range: 1-100 + - field: type + note: "文档类型" + range: product,project,execution,custom,api,mine{6} + - field: vision + note: "文档类型" + range: rnd{7},or{2},lite{2} \ No newline at end of file From 7d449e4b7ec5df86907d0e4a0a62a56f41884786 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:05:49 +0800 Subject: [PATCH 14/26] + [unittest] add unit test of upgradeModel::upgradeMyDocSpace. --- .../upgrade/test/model/upgrademydocspace.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 module/upgrade/test/model/upgrademydocspace.php diff --git a/module/upgrade/test/model/upgrademydocspace.php b/module/upgrade/test/model/upgrademydocspace.php new file mode 100644 index 0000000000..dfb8231fc2 --- /dev/null +++ b/module/upgrade/test/model/upgrademydocspace.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +upgradeMyDocSpace(); +cid=1 + +**/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/upgrade.unittest.class.php'; + +zenData('doclib')->loadYaml('doclib')->gen(10); + +$upgrade = new upgradeTest(); + +$beforeUpgrade = $tester->dao->select('*')->from('zt_doclib')->where('type')->eq('mine')->fetchAll('id'); \ No newline at end of file From 9b2c7d9159d8096e123ea1d55088d8551eb9a81c Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:06:20 +0800 Subject: [PATCH 15/26] + [unittest] add unit test of upgradeModel::upgradeMyDocSpace. --- .../upgrade/test/model/upgrademydocspace.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/module/upgrade/test/model/upgrademydocspace.php b/module/upgrade/test/model/upgrademydocspace.php index dfb8231fc2..718f35ae2e 100644 --- a/module/upgrade/test/model/upgrademydocspace.php +++ b/module/upgrade/test/model/upgrademydocspace.php @@ -16,4 +16,21 @@ zenData('doclib')->loadYaml('doclib')->gen(10); $upgrade = new upgradeTest(); -$beforeUpgrade = $tester->dao->select('*')->from('zt_doclib')->where('type')->eq('mine')->fetchAll('id'); \ No newline at end of file +$beforeUpgrade = $tester->dao->select('*')->from('zt_doclib')->where('type')->eq('mine')->fetchAll('id'); + +$upgrade->upgradeMyDocSpace(); + +global $tester; + +$myDocLibs = $tester->dao->select('*')->from('zt_doclib')->where('type')->eq('mine')->fetchAll('id'); + +r(count($beforeUpgrade)) && p() && e(5); // 获取更新前我的文档库数量。 +r(count($myDocLibs)) && p() && e(8); // 获取更新后我的文档库数量。 +r($myDocLibs[6]) && p('id,main,vision,parent') && e('6,0,rnd,11'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[7]) && p('id,main,vision,parent') && e('7,0,rnd,11'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[8]) && p('id,main,vision,parent') && e('8,0,or,13'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[9]) && p('id,main,vision,parent') && e('9,0,or,13'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[10]) && p('id,main,vision,parent') && e('10,0,lite,12'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[11]) && p('id,main,vision,parent') && e('11,1,rnd,0'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[12]) && p('id,main,vision,parent') && e('12,1,lite,0'); // 获取更新后我的文档库 6 的信息 +r($myDocLibs[13]) && p('id,main,vision,parent') && e('13,1,or,0'); // 获取更新后我的文档库 6 的信息 \ No newline at end of file From 069b120bf9b3ae83d7ad7c76c40b3912866403ba Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:07:19 +0800 Subject: [PATCH 16/26] + [unittest] add unit test of searchTao::processBuildinFields. --- .../search/test/lib/search.unittest.class.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/module/search/test/lib/search.unittest.class.php b/module/search/test/lib/search.unittest.class.php index d0d5ef9249..7e6dda3aee 100755 --- a/module/search/test/lib/search.unittest.class.php +++ b/module/search/test/lib/search.unittest.class.php @@ -675,4 +675,25 @@ class searchTest return $dataList; } -} + + /** + * 处理工作。设置内置字段的搜索参数。 + * Process build in fields. + * + * @param string $module + * @access public + * @return array + */ + public function processBuildinFieldsTest(string $module): array + { + global $tester; + $searchConfig = $tester->loadModel($module)->buildSearchConfig(1, 'story'); + $result = $this->objectModel->processBuildinFields('projectStory', $searchConfig); + $resultFields = array_keys($result['fields']); + $resultFields = implode(',', $resultFields); + $result['fields'] = $resultFields; + $result['maxCount'] = $this->objectModel->config->maxCount; + + return $result; + } +} \ No newline at end of file From e987df363b2a662335faac8012b296067db70563 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:09:49 +0800 Subject: [PATCH 17/26] + [unittest] add unit test of searchTao::processBuildinFields. --- .../search/test/tao/processbuildinfields.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 module/search/test/tao/processbuildinfields.php diff --git a/module/search/test/tao/processbuildinfields.php b/module/search/test/tao/processbuildinfields.php new file mode 100755 index 0000000000..722a2e7fb6 --- /dev/null +++ b/module/search/test/tao/processbuildinfields.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +processBuildinFields() + * + * @title=测试 searchTao->processBuildinFields(); + * @timeout=0 + * @cid=1 + */ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/search.unittest.class.php'; + +su('admin'); + +$search = new searchTest(); + +$moduleList = array('projectStory', 'bug', 'product', 'testcase', 'caselib'); + +r($search->processBuildinFieldsTest($moduleList[0])) && p('module;fields;maxCount', ';') && e('story;title,id,keywords,status,pri,module,stage,grade,plan,estimate,source,sourceNote,fromBug,category,openedBy,reviewedBy,result,assignedTo,closedBy,lastEditedBy,mailto,closedReason,version,openedDate,reviewedDate,assignedDate,closedDate,lastEditedDate,activatedDate;500'); // projectstory +r($search->processBuildinFieldsTest($moduleList[1])) && p('module;fields;maxCount', ';') && e('bug;title,module,keywords,steps,assignedTo,resolvedBy,status,confirmed,story,project,branch,plan,id,execution,severity,pri,type,os,browser,resolution,activatedCount,toTask,toStory,openedBy,closedBy,lastEditedBy,mailto,openedBuild,resolvedBuild,openedDate,assignedDate,resolvedDate,closedDate,lastEditedDate,deadline,activatedDate;500'); // bug +r($search->processBuildinFieldsTest($moduleList[2])) && p('module;fields;maxCount', ';') && e('story;title,id,keywords,status,pri,module,stage,grade,plan,estimate,source,sourceNote,fromBug,category,openedBy,reviewedBy,result,assignedTo,closedBy,lastEditedBy,mailto,closedReason,version,openedDate,reviewedDate,assignedDate,closedDate,lastEditedDate,activatedDate;500'); // product +r($search->processBuildinFieldsTest($moduleList[3])) && p('module;fields;maxCount', ';') && e('testcase;title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,stage,module,pri,lib,lastRunner,lastRunResult,lastRunDate,openedDate,lastEditedDate,scene;500'); // testcase +r($search->processBuildinFieldsTest($moduleList[4])) && p('module;fields;maxCount', ';') && e('caselib;title,story,id,keywords,lastEditedBy,type,auto,openedBy,status,stage,module,pri,openedDate,lastEditedDate;500'); // caselib From 8ab885cc726b2130dba5559239e4e0c3a22ffb15 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:11:03 +0800 Subject: [PATCH 18/26] + [unittest] add unit test of searchModel::setDefaultParams. --- .../search/test/lib/search.unittest.class.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/module/search/test/lib/search.unittest.class.php b/module/search/test/lib/search.unittest.class.php index 7e6dda3aee..39724ddadd 100755 --- a/module/search/test/lib/search.unittest.class.php +++ b/module/search/test/lib/search.unittest.class.php @@ -696,4 +696,27 @@ class searchTest return $result; } + + /** + * 设置默认搜索参数配置。 + * Test: set default search params. + * + * @param array $fields + * @param array $params + * @access public + * @return array + */ + public function setDefaultParamsTest(array $fields, array $params): string + { + $_SESSION['project'] = 0; + $_SESSION['searchParams']['module'] = 'bug'; + + $result = $this->objectModel->setDefaultParams($fields, $params); + $field = key($result); + $value = zget($result[$field], 'values', array()); + + $return = implode(',', array_keys($value)); + + return str_replace('@', '', $return); + } } \ No newline at end of file From 4a5cc7389971df427611e605a16107ca453b4f46 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:11:45 +0800 Subject: [PATCH 19/26] + [unittest] add unit test of searchModel::setDefaultParams. --- module/search/test/model/setdefaultparams.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 module/search/test/model/setdefaultparams.php diff --git a/module/search/test/model/setdefaultparams.php b/module/search/test/model/setdefaultparams.php new file mode 100755 index 0000000000..9332fc232c --- /dev/null +++ b/module/search/test/model/setdefaultparams.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +setDefaultParams(); +timeout=0 +cid=1 + +*/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/search.unittest.class.php'; + +zenData('user')->gen(5); +zenData('project')->gen(30); +zenData('projectproduct')->gen(10); +zenData('product')->gen(10); + +su('admin'); \ No newline at end of file From 778c23823ba0fdb733cc51b9ee3b2468455e93f7 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 16 Apr 2025 15:11:54 +0800 Subject: [PATCH 20/26] + [unittest] add unit test of searchModel::setDefaultParams. --- module/search/test/model/setdefaultparams.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/module/search/test/model/setdefaultparams.php b/module/search/test/model/setdefaultparams.php index 9332fc232c..a767eee065 100755 --- a/module/search/test/model/setdefaultparams.php +++ b/module/search/test/model/setdefaultparams.php @@ -17,4 +17,28 @@ zenData('project')->gen(30); zenData('projectproduct')->gen(10); zenData('product')->gen(10); -su('admin'); \ No newline at end of file +su('admin'); + +$fields1 = array('product' => 'product'); +$fields2 = array('assignedTo' => 'assignedTo'); +$fields3 = array('execution' => 'execution'); +$fields4 = array('project' => 'project'); +$fields5 = array('product' => 'product'); +$fields6 = array('product' => 'product'); +$fields7 = array('product' => 'product'); +$params1 = array('product' => array('values' => 'products')); +$params2 = array('assignedTo' => array('values' => 'users')); +$params3 = array('execution' => array('values' => 'executions')); +$params4 = array('project' => array('values' => array())); +$params5 = array('product' => array('values' => array(''))); +$params6 = array('product' => array('values' => array(1))); +$params7 = array('product' => array('values' => array(''), 'nonull' => true)); + +$search = new searchTest(); +r($search->setDefaultParamsTest($fields1, $params1)) && p('0') && e('1,2,3,4,5,6,7,8,9,10,null'); // 测试设置 products 的默认参数 +r($search->setDefaultParamsTest($fields2, $params2)) && p('0') && e('admin,user1,user2,user3,user4,$me,null'); // 测试设置 users 的默认参数 +r($search->setDefaultParamsTest($fields3, $params3)) && p('0') && e(',null'); // 测试设置 executions 的默认参数 +r($search->setDefaultParamsTest($fields4, $params4)) && p('0') && e(',null'); // 测试设置 空数组 的默认参数 +r($search->setDefaultParamsTest($fields5, $params5)) && p('0') && e('0,null'); // 测试设置 空字符串 的默认参数 +r($search->setDefaultParamsTest($fields6, $params6)) && p('0') && e('ZERO'); // 测试设置 array(1) 的默认参数 +r($search->setDefaultParamsTest($fields7, $params7)) && p('0') && e('0'); // 测试设置 nonull 的默认参数 \ No newline at end of file From 7aba8cb4327c5a3fdbdb5bf1627d8b159c164775 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:53:21 +0800 Subject: [PATCH 21/26] * [ci,doing,0.1h] add unit test for updatedocorder method. --- module/doc/test/model/updatedocorder.php | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 module/doc/test/model/updatedocorder.php diff --git a/module/doc/test/model/updatedocorder.php b/module/doc/test/model/updatedocorder.php new file mode 100644 index 0000000000..36c9bc0936 --- /dev/null +++ b/module/doc/test/model/updatedocorder.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +updateDocOrder(); +cid=1 + +- 检查ID为1的文档顺序 @3 +- 检查ID为2的文档顺序 @1 +- 检查ID为3的文档顺序 @8 +- 检查ID为4的文档顺序 @9 +- 检查ID为5的文档顺序 @2 +- 检查ID为6的文档顺序 @10 +- 检查ID为7的文档顺序 @5 +- 检查ID为8的文档顺序 @7 +- 检查ID为9的文档顺序 @6 +- 检查ID为10的文档顺序 @4 + +*/ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php'; + +$docData = zenData('doc')->loadYaml('doc'); +$docData->order->range('1-10'); +$docData->gen(10); + +zenData('user')->gen(5); +su('admin'); From d1608ab2898075f01e41bfbc94996c699b6776cf Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:54:25 +0800 Subject: [PATCH 22/26] * [ci,done,0.3h] add unit test for updatedocorder method. --- module/doc/test/lib/doc.unittest.class.php | 16 ++++++++++++++++ module/doc/test/model/updatedocorder.php | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/module/doc/test/lib/doc.unittest.class.php b/module/doc/test/lib/doc.unittest.class.php index 8bb3fe14b6..88383b86d5 100644 --- a/module/doc/test/lib/doc.unittest.class.php +++ b/module/doc/test/lib/doc.unittest.class.php @@ -1457,4 +1457,20 @@ class docTest $deleted = $this->objectModel->dao->select('deleted')->from($table)->where('id')->eq($id)->fetch('deleted'); return $deleted == 1; } + + /** + * 更新文档顺序。 + * Update doc order. + * + * @param array $sortedIdList + * @access public + * @return array|bool + */ + public function updateDocOrderTest(array $sortedIdList): array|bool + { + $this->objectModel->updateDocOrder($sortedIdList); + + if(dao::isError()) return dao::getError(); + return $this->objectModel->dao->select('id,`order`')->from(TABLE_DOC)->where('id')->in($sortedIdList)->fetchPairs(); + } } diff --git a/module/doc/test/model/updatedocorder.php b/module/doc/test/model/updatedocorder.php index 36c9bc0936..bfa6d542b4 100644 --- a/module/doc/test/model/updatedocorder.php +++ b/module/doc/test/model/updatedocorder.php @@ -23,6 +23,20 @@ include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php'; $docData = zenData('doc')->loadYaml('doc'); $docData->order->range('1-10'); $docData->gen(10); - zenData('user')->gen(5); su('admin'); + +$sortedIdList = array(2, 5, 1, 10, 7, 9, 8, 3, 4, 6); + +$docTester = new docTest(); +$sortedDocList = $docTester->updateDocOrderTest($sortedIdList); +r($sortedDocList[1]) && p() && e('3'); // 检查ID为1的文档顺序 +r($sortedDocList[2]) && p() && e('1'); // 检查ID为2的文档顺序 +r($sortedDocList[3]) && p() && e('8'); // 检查ID为3的文档顺序 +r($sortedDocList[4]) && p() && e('9'); // 检查ID为4的文档顺序 +r($sortedDocList[5]) && p() && e('2'); // 检查ID为5的文档顺序 +r($sortedDocList[6]) && p() && e('10'); // 检查ID为6的文档顺序 +r($sortedDocList[7]) && p() && e('5'); // 检查ID为7的文档顺序 +r($sortedDocList[8]) && p() && e('7'); // 检查ID为8的文档顺序 +r($sortedDocList[9]) && p() && e('6'); // 检查ID为9的文档顺序 +r($sortedDocList[10]) && p() && e('4'); // 检查ID为10的文档顺序 From 55c0c8ec3764333b08312baf19567109000b9f2e Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:55:12 +0800 Subject: [PATCH 23/26] * [ci,doing,0.3h] add unit test for getspaces method. --- module/doc/test/model/getspaces.php | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 module/doc/test/model/getspaces.php diff --git a/module/doc/test/model/getspaces.php b/module/doc/test/model/getspaces.php new file mode 100644 index 0000000000..5cfbf00811 --- /dev/null +++ b/module/doc/test/model/getspaces.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php +getSpaces(); +cid=1 + +- 测试获取不存在类型的空间 @0 +- 测试获取我的空间数据第0条的type属性 @mine +- 测试获取自定义空间数据第0条的type属性 @custom +- 测试获取产品空间数据第0条的type属性 @product +- 测试获取项目空间数据第0条的type属性 @project +- 测试获取执行空间数据第0条的name属性 @迭代5 + +*/ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php'; + +$docLibData = zenData('doclib')->loadYaml('doclib'); +$docLibData->type->range('mine,custom,product,project,execution'); +$docLibData->parent->range('0'); +$docLibData->gen(10); + +zenData('product')->loadYaml('product')->gen(10); +zenData('project')->loadYaml('execution')->gen(10); +zenData('user')->gen(5); +su('admin'); + +$typeList = array('all', 'mine', 'custom', 'product', 'project', 'execution'); +$spaceIdList = array(0, 1, 2, 3, 4, 101); From 04d3f8a8a3bdc382de5a9c298418af8b291c3538 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:57:21 +0800 Subject: [PATCH 24/26] * [ci,done,0.1] add unit test for getspaces method. --- module/doc/test/model/getspaces.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/doc/test/model/getspaces.php b/module/doc/test/model/getspaces.php index 5cfbf00811..1b350bc45e 100644 --- a/module/doc/test/model/getspaces.php +++ b/module/doc/test/model/getspaces.php @@ -28,3 +28,11 @@ su('admin'); $typeList = array('all', 'mine', 'custom', 'product', 'project', 'execution'); $spaceIdList = array(0, 1, 2, 3, 4, 101); + +$docTester = new docTest(); +r($docTester->objectModel->getSpaces($typeList[0], $spaceIdList[0])[0]) && p('0') && e('0'); // 测试获取不存在类型的空间 +r($docTester->objectModel->getSpaces($typeList[1], $spaceIdList[1])[0]) && p('0:type') && e('mine'); // 测试获取我的空间数据 +r($docTester->objectModel->getSpaces($typeList[2], $spaceIdList[2])[0]) && p('0:type') && e('custom'); // 测试获取自定义空间数据 +r($docTester->objectModel->getSpaces($typeList[3], $spaceIdList[3])[0]) && p('0:type') && e('product'); // 测试获取产品空间数据 +r($docTester->objectModel->getSpaces($typeList[4], $spaceIdList[4])[0]) && p('0:type') && e('project'); // 测试获取项目空间数据 +r($docTester->objectModel->getSpaces($typeList[5], $spaceIdList[5])[0]) && p('0:name') && e('迭代5'); // 测试获取执行空间数据 From bd6302dc3b0d9a69198b732a8e2f05786db198bf Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:58:36 +0800 Subject: [PATCH 25/26] * [ci,doing,0.2h] add unit test for updatedocliborder method. --- module/doc/test/model/updatedocliborder.php | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 module/doc/test/model/updatedocliborder.php diff --git a/module/doc/test/model/updatedocliborder.php b/module/doc/test/model/updatedocliborder.php new file mode 100644 index 0000000000..8534c96279 --- /dev/null +++ b/module/doc/test/model/updatedocliborder.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +updateDocLibOrder(); +cid=1 + +- 测试更新ID为0的文档库顺序为2 @0 +- 测试更新ID为1的文档库顺序为5 @5 +- 测试更新ID为2的文档库顺序为1 @1 +- 测试更新ID为3的文档库顺序为10 @10 +- 测试更新ID为4的文档库顺序为7 @7 +- 测试更新ID为5的文档库顺序为9 @9 +- 测试更新ID不存在的文档库顺序为8 @0 + +*/ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/doc.unittest.class.php'; + +$docLibData = zenData('doclib')->loadYaml('doclib'); +$docLibData->order->range('1-5'); +$docLibData->gen(5); +zenData('user')->gen(5); +su('admin'); + +$idList = array(0, 1, 2, 3, 4, 5, 6); +$orderList = array(2, 5, 1, 10, 7, 9, 8); From cec5625a61f24f34a495f0d5d24793a822fb0ab8 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 16 Apr 2025 14:58:54 +0800 Subject: [PATCH 26/26] * [ci,done,0.3h] add unit test for updatedocliborder method. --- module/doc/test/lib/doc.unittest.class.php | 17 +++++++++++++++++ module/doc/test/model/updatedocliborder.php | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/module/doc/test/lib/doc.unittest.class.php b/module/doc/test/lib/doc.unittest.class.php index 88383b86d5..dabbf5d377 100644 --- a/module/doc/test/lib/doc.unittest.class.php +++ b/module/doc/test/lib/doc.unittest.class.php @@ -1473,4 +1473,21 @@ class docTest if(dao::isError()) return dao::getError(); return $this->objectModel->dao->select('id,`order`')->from(TABLE_DOC)->where('id')->in($sortedIdList)->fetchPairs(); } + + /** + * 更新文档库顺序。 + * Update doclib order. + * + * @param int $catalogID + * @param int $order + * @access public + * @return int|bool + */ + public function updateDoclibOrderTest(int $id, int $order): int|bool + { + $this->objectModel->updateDoclibOrder($id, $order); + + if(dao::isError()) return dao::getError(); + return $this->objectModel->dao->select('`order`')->from(TABLE_DOCLIB)->where('id')->eq($id)->fetch('order'); + } } diff --git a/module/doc/test/model/updatedocliborder.php b/module/doc/test/model/updatedocliborder.php index 8534c96279..28abb3e166 100644 --- a/module/doc/test/model/updatedocliborder.php +++ b/module/doc/test/model/updatedocliborder.php @@ -25,3 +25,12 @@ su('admin'); $idList = array(0, 1, 2, 3, 4, 5, 6); $orderList = array(2, 5, 1, 10, 7, 9, 8); + +$docLibTester = new docTest(); +r($docLibTester->updateDoclibOrderTest($idList[0], $orderList[0])) && p() && e('0'); // 测试更新ID为0的文档库顺序为2 +r($docLibTester->updateDoclibOrderTest($idList[1], $orderList[1])) && p() && e('5'); // 测试更新ID为1的文档库顺序为5 +r($docLibTester->updateDoclibOrderTest($idList[2], $orderList[2])) && p() && e('1'); // 测试更新ID为2的文档库顺序为1 +r($docLibTester->updateDoclibOrderTest($idList[3], $orderList[3])) && p() && e('10'); // 测试更新ID为3的文档库顺序为10 +r($docLibTester->updateDoclibOrderTest($idList[4], $orderList[4])) && p() && e('7'); // 测试更新ID为4的文档库顺序为7 +r($docLibTester->updateDoclibOrderTest($idList[5], $orderList[5])) && p() && e('9'); // 测试更新ID为5的文档库顺序为9 +r($docLibTester->updateDoclibOrderTest($idList[6], $orderList[6])) && p() && e('0'); // 测试更新ID不存在的文档库顺序为8