diff --git a/module/common/model.php b/module/common/model.php index 29c894add8..5b32205207 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1507,6 +1507,7 @@ class commonModel extends model } /** + * 检查RESTful API调用是否合法。 * Check an entry of new API. * * @access public @@ -1530,6 +1531,7 @@ class commonModel extends model } /** + * 检查旧版API调用是否合法。 * Check an entry. * * @access public @@ -1593,13 +1595,14 @@ class commonModel extends model } /** + * 检查Token是否合法。 * Check token of an entry. * * @param object $entry * @access public * @return bool */ - public function checkEntryToken($entry) + public function checkEntryToken(object $entry): bool { parse_str($this->server->query_String, $queryString); unset($queryString['token']); @@ -1626,19 +1629,21 @@ class commonModel extends model } /** + * 检查当前语言项是否为中文。 * Check Not CN Lang. * * @static * @access public * @return bool */ - public static function checkNotCN() + public static function checkNotCN(): bool { global $app; return strpos('|zh-cn|zh-tw|', '|' . $app->getClientLang() . '|') === false; } /** + * 检查对象是否可被修改。 * Check the object can be changed. * * @param string $module @@ -1647,7 +1652,7 @@ class commonModel extends model * @access public * @return bool */ - public static function canBeChanged($module, $object = null) + public static function canBeChanged(string $module, object $object = null): bool { if(defined('RUN_MODE') && RUN_MODE == 'api') return true; diff --git a/module/common/test/model/appendorder.php b/module/common/test/model/appendorder.php index eeb268ab4e..473d98f751 100755 --- a/module/common/test/model/appendorder.php +++ b/module/common/test/model/appendorder.php @@ -30,4 +30,4 @@ $order4 = $tester->common->appendOrder('account_desc', 'id'); r($order1) && p() && e('status_asc,name_asc'); // 正序追加name排序 r($order2) && p() && e('status_desc,name_desc'); // 倒序追加name排序 r($order3) && p() && e('account_asc,id_asc'); // 正序追加id排序 -r($order4) && p() && e('account_desc,id_desc'); // 倒序追加id排序 +r($order4) && p() && e('account_desc,id_desc'); // 倒序追加id排序 \ No newline at end of file diff --git a/module/common/test/model/canbechanged.php b/module/common/test/model/canbechanged.php new file mode 100755 index 0000000000..258d65b407 --- /dev/null +++ b/module/common/test/model/canbechanged.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +config('execution')->gen(500); +zdTable('task')->gen(1); +zdTable('story')->gen(1); +zdTable('bug')->gen(1); +zdTable('testtask')->gen(1); +zdTable('case')->gen(1); + +/** + +title=测试 commonModel::diff(); +timeout=0 +cid=1 + +- 查看需求是否可以被修改 @1 +- 查看bug是否可以被修改 @1 +- 查看测试任务是否可以被修改 @1 +- 查看任务是否可以被修改 @1 +- 查看用例是否可以被修改 @1 + +*/ + +global $tester; + +$task = $tester->loadModel('task')->fetchById(1); +$story = $tester->loadModel('story')->fetchById(1); +$bug = $tester->loadModel('bug')->fetchById(1); +$test = $tester->loadModel('testtask')->fetchById(1); +$case = $tester->loadModel('testcase')->fetchById(1); + +$result1 = commonModel::canBeChanged('story', $story); +$result2 = commonModel::canBeChanged('bug', $bug); +$result3 = commonModel::canBeChanged('testtask', $test); +$result4 = commonModel::canBeChanged('task', $task); +$result5 = commonModel::canBeChanged('case', $case); + +r($result1) && p() && e('1'); // 查看需求是否可以被修改 +r($result2) && p() && e('1'); // 查看bug是否可以被修改 +r($result3) && p() && e('1'); // 查看测试任务是否可以被修改 +r($result4) && p() && e('1'); // 查看任务是否可以被修改 +r($result5) && p() && e('1'); // 查看用例是否可以被修改 \ No newline at end of file diff --git a/module/common/test/model/checkfield.php b/module/common/test/model/checkfield.php index f98e54c7a8..137a38d349 100755 --- a/module/common/test/model/checkfield.php +++ b/module/common/test/model/checkfield.php @@ -9,13 +9,11 @@ title=测试 commonModel->checkField(); timeout=0 cid=1 -- 正序追加name排序 @status_asc,name_asc - -- 倒序追加name排序 @status_desc,name_desc - -- 正序追加id排序 @account_asc,id_asc - -- 倒序追加id排序 @account_desc,id_desc +- 查看需求表中的id字段是否存在 @1 +- 查看需求表中的tester字段是否存在 @0 +- 查看任务表中的name字段是否存在 @1 +- 查看任务表中的title字段是否存在 @0 +- 查看任务表中的空字段是否存在 @0 */ @@ -32,4 +30,4 @@ r($result1) && p() && e('1'); // 查看需求表中的id字段是否存在 r($result2) && p() && e('0'); // 查看需求表中的tester字段是否存在 r($result3) && p() && e('1'); // 查看任务表中的name字段是否存在 r($result4) && p() && e('0'); // 查看任务表中的title字段是否存在 -r($result5) && p() && e('0'); // 查看任务表中的空字段是否存在 +r($result5) && p() && e('0'); // 查看任务表中的空字段是否存在 \ No newline at end of file diff --git a/module/common/test/model/formatdate.php b/module/common/test/model/formatdate.php index 305c2dcaa2..6838c1c79e 100755 --- a/module/common/test/model/formatdate.php +++ b/module/common/test/model/formatdate.php @@ -33,4 +33,4 @@ r($date2) && p() && e('2023-01-01 00:00:00'); // 查看格式化后的日期 r($date3) && p() && e('2023-01-01 00:00:00'); // 查看格式化后的日期 r($date4) && p() && e('2023-01-01'); // 查看格式化后的日期 r($date5) && p() && e('2023-01-01 12:12:12'); // 查看格式化后的日期 -r($date6) && p() && e('2023-01-01 12:12:12'); // 查看格式化后的日期 +r($date6) && p() && e('2023-01-01 12:12:12'); // 查看格式化后的日期 \ No newline at end of file diff --git a/module/common/test/model/getpreandnextobject.php b/module/common/test/model/getpreandnextobject.php old mode 100644 new mode 100755 index 311e4f271a..56fd8d2abe --- a/module/common/test/model/getpreandnextobject.php +++ b/module/common/test/model/getpreandnextobject.php @@ -8,8 +8,19 @@ zdTable('story')->gen(10); /** title=测试 commonModel->getPreAndNextObject(); +timeout=0 cid=1 -pid=1 + +- 执行common模块的getPreAndNextObject方法,参数是'', 3 + - 属性pre @~~ + - 属性next @~~ +- 执行common模块的getPreAndNextObject方法,参数是'story', 3 + - 属性pre @~~ + - 属性next @~~ +- 执行$preAndNextObject->pre属性id @2 +- 执行$preAndNextObject->next属性id @4 +- 执行$preAndNextObject->pre属性id @2 +- 执行$preAndNextObject->next属性id @4 */ @@ -33,4 +44,4 @@ $_SESSION['storyQueryCondition'] = 'SELECT * FROM `zt_story` WHERE id <= 4'; $_SESSION['storyOnlyCondition'] = false; $preAndNextObject = $tester->common->getPreAndNextObject('story', 3); r($preAndNextObject->pre) && p('id') && e('2'); -r($preAndNextObject->next) && p('id') && e('4'); +r($preAndNextObject->next) && p('id') && e('4'); \ No newline at end of file diff --git a/module/common/test/model/isopenmethod.php b/module/common/test/model/isopenmethod.php index 7c5cd5336c..78fc3f6e53 100755 --- a/module/common/test/model/isopenmethod.php +++ b/module/common/test/model/isopenmethod.php @@ -27,4 +27,4 @@ $priv4 = $tester->common->isOpenMethod('product', 'showerrornone'); r($priv1) && p() && e('1'); r($priv2) && p() && e('1'); r($priv3) && p() && e('0'); -r($priv4) && p() && e('1'); +r($priv4) && p() && e('1'); \ No newline at end of file diff --git a/module/common/test/model/removeduplicate.php b/module/common/test/model/removeduplicate.php old mode 100644 new mode 100755 index 6354e6a160..6852c12287 --- a/module/common/test/model/removeduplicate.php +++ b/module/common/test/model/removeduplicate.php @@ -31,8 +31,39 @@ $doc->gen(1); /** title=测试 commonModel->removeDuplicate(); +timeout=0 cid=1 -pid=1 + +- 测试是否是重复需求 + - 属性stop @1 + - 属性duplicate @1 +- 有条件情况下,测试是否是重复需求。属性stop @~~ +- 测试是否是重复用例 + - 属性stop @1 + - 属性duplicate @1 +- 有条件情况下,测试是否是重复用例。属性stop @~~ +- 测试是否是重复任务 + - 属性stop @1 + - 属性duplicate @1 +- 有条件情况下,测试是否是重复用例。属性stop @~~ +- 测试是否是重复Bug + - 属性stop @1 + - 属性duplicate @1 +- 有条件情况下,测试是否是重复Bug属性stop @~~ +- 测试是否是重复文档 + - 属性stop @1 + - 属性duplicate @1 +- 有条件情况下,测试是否是重复文档属性stop @~~ +- 测试批量重复需求 @story1 +- 有条件情况下,测试批量重复需求 @2 +- 测试批量重复用例 @case1 +- 有条件情况下,测试批量重复用例 @2 +- 测试批量重复任务 @task1 +- 有条件情况下,测试批量重复任务 @2 +- 测试批量重复Bug @bug1 +- 有条件情况下,测试批量重复Bug @2 +- 测试批量重复文档 @doc1 +- 有条件情况下,测试批量重复文档 @2 */ @@ -114,4 +145,4 @@ r($result['data']->title[1]) && p() && e('doc1'); //测试批量重复文档 $doc->title = array('testdoc', 'doc1'); $result = $tester->common->removeDuplicate('doc', $doc, 'id!=1'); -r(count($result['data']->title)) && p() && e('2'); //有条件情况下,测试批量重复文档 +r(count($result['data']->title)) && p() && e('2'); //有条件情况下,测试批量重复文档 \ No newline at end of file diff --git a/module/common/test/model/syncexecutionstatus.php b/module/common/test/model/syncexecutionstatus.php index 94a449d408..8b071c4719 100755 --- a/module/common/test/model/syncexecutionstatus.php +++ b/module/common/test/model/syncexecutionstatus.php @@ -3,7 +3,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; su('admin'); -zdTable('project')->config('execution')->gen(10); +zdTable('project')->config('execution')->gen(200); zdTable('task')->gen(10); /** @@ -43,4 +43,4 @@ $execution3 = $tester->execution->getById(103); r($execution1) && p('status') && e('doing'); // 任务开始将执行的状态设为doing r($execution2) && p('status') && e('doing'); // 任务开始将执行的状态设为doing -r($execution3) && p('status') && e('doing'); // 任务开始将执行的状态设为doing +r($execution3) && p('status') && e('doing'); // 任务开始将执行的状态设为doing \ No newline at end of file diff --git a/module/common/test/model/syncprojectstatus.php b/module/common/test/model/syncprojectstatus.php index bb2717d83f..12cead1ada 100755 --- a/module/common/test/model/syncprojectstatus.php +++ b/module/common/test/model/syncprojectstatus.php @@ -3,8 +3,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; su('admin'); -zdTable('project')->gen(100); -zdTable('project')->config('execution')->gen(200, false); +zdTable('project')->config('execution')->gen(200); /** diff --git a/module/common/test/yaml/execution.yaml b/module/common/test/yaml/execution.yaml index c01c1e03cb..13b3a2a0f3 100644 --- a/module/common/test/yaml/execution.yaml +++ b/module/common/test/yaml/execution.yaml @@ -1,22 +1,22 @@ title: table zt_execution -author: Zhu Jinyong +author: Sun Guangming version: "1.0" fields: - field: id - range: 101-700 + range: 1-700 - field: name note: "名称" fields: - field: name1 - range: 迭代{30},阶段{30},看板{30} + range: 项目集{10},项目{90},迭代{200},阶段{200},看板{200} - field: name2 range: 1-10000 - field: project - range: 11-100 + range: 0{10},1-10{9},11-100 - field: model - range: [] + range: "[]{10},[scrum,waterfall,kanban,agileplus,waterfallplus]{30!}" - field: type - range: sprint{30},stage{30},kanban{30} + range: program{10},project{90},sprint{200},stage{200},kanban{200} - field: budget range: 800000-1:100 - field: status @@ -29,7 +29,7 @@ fields: range: "extend" - field: desc range: 1-10000 - prefix: "迭代描述" + prefix: "描述" - field: begin range: "(-2M)-(+M):1D" type: timestamp @@ -43,33 +43,4 @@ fields: - field: grade range: 1 - field: parent - range: 11-40,41-70,71-100 - - field: path - fields: - - field: path1 - prefix: "," - range: 11-100 - - field: path2 - prefix: "," - range: 101-700 - postfix: "," - - field: acl - range: open{4},private{4} - - field: openedVersion - range: "16.5" - - field: whitelist - froms: - - from: common.user.v1.yaml - use: empty{8} - - from: common.user.v1.yaml - use: empty{8} - prefix: "," - - from: common.user.v1.yaml - use: one{8} - prefix: "," - - from: common.user.v1.yaml - use: two{8} - prefix: "," - - from: common.user.v1.yaml - use: three{8} - prefix: "," + range: 0{10},1-10{9},11-100