From 82e18ab5ec114eb12d92938f6eec1092618a1ac4 Mon Sep 17 00:00:00 2001 From: zhangxuwen Date: Sat, 2 Apr 2022 11:05:40 +0800 Subject: [PATCH 01/39] auto test cron model --- test/class/caselib.class.php | 105 ++++++++++ test/class/cron.class.php | 254 ++++++++++++++++++++++++ test/model/cron/changestatus.php | 24 +++ test/model/cron/changestatusrunning.php | 24 +++ test/model/cron/checkchange.php | 17 ++ test/model/cron/checkrule.php | 46 +++++ test/model/cron/create.php | 34 ++++ test/model/cron/getbyid.php | 20 ++ test/model/cron/getconfigid.php | 18 ++ test/model/cron/getcrons.php | 21 ++ test/model/cron/getlasttime.php | 18 ++ test/model/cron/getturnon.php | 18 ++ test/model/cron/logcron.php | 23 +++ test/model/cron/markcronstatus.php | 29 +++ test/model/cron/parsecron.php | 22 ++ test/model/cron/runable.php | 37 ++++ test/model/cron/update.php | 36 ++++ test/ztest | 6 + 18 files changed, 752 insertions(+) create mode 100644 test/class/cron.class.php create mode 100644 test/model/cron/changestatus.php create mode 100644 test/model/cron/changestatusrunning.php create mode 100644 test/model/cron/checkchange.php create mode 100644 test/model/cron/checkrule.php create mode 100644 test/model/cron/create.php create mode 100644 test/model/cron/getbyid.php create mode 100644 test/model/cron/getconfigid.php create mode 100644 test/model/cron/getcrons.php create mode 100644 test/model/cron/getlasttime.php create mode 100644 test/model/cron/getturnon.php create mode 100644 test/model/cron/logcron.php create mode 100644 test/model/cron/markcronstatus.php create mode 100644 test/model/cron/parsecron.php create mode 100644 test/model/cron/runable.php create mode 100644 test/model/cron/update.php diff --git a/test/class/caselib.class.php b/test/class/caselib.class.php index 3c7ce07afc..19523316be 100644 --- a/test/class/caselib.class.php +++ b/test/class/caselib.class.php @@ -7,6 +7,14 @@ class caselibTest $this->objectModel = $tester->loadModel('caselib'); } + /** + * Set lib menu test. + * + * @param mixed $libraries + * @param mixed $libID + * @access public + * @return void + */ public function setLibMenuTest($libraries, $libID) { $objects = $this->objectModel->setLibMenu($libraries, $libID); @@ -16,6 +24,14 @@ class caselibTest return $objects; } + /** + * Save lib state test. + * + * @param int $libID + * @param array $libraries + * @access public + * @return void + */ public function saveLibStateTest($libID = 0, $libraries = array()) { $objects = $this->objectModel->saveLibState($libID, $libraries); @@ -25,6 +41,14 @@ class caselibTest return $objects; } + /** + * Get by ID test. + * + * @param mixed $libID + * @param mixed $setImgSize + * @access public + * @return void + */ public function getByIdTest($libID, $setImgSize = false) { $objects = $this->objectModel->getById($libID, $setImgSize); @@ -34,6 +58,13 @@ class caselibTest return $objects; } + /** + * Update test. + * + * @param mixed $libID + * @access public + * @return void + */ public function updateTest($libID) { $objects = $this->objectModel->update($libID); @@ -45,6 +76,14 @@ class caselibTest return $objects; } + /** + * Delete test. + * + * @param mixed $libID + * @param string $table + * @access public + * @return void + */ public function deleteTest($libID, $table = '') { $objects = $this->objectModel->delete($libID, $table); @@ -56,6 +95,12 @@ class caselibTest return $objects; } + /** + * Get libraries test. + * + * @access public + * @return void + */ public function getLibrariesTest() { $objects = $this->objectModel->getLibraries(); @@ -65,6 +110,14 @@ class caselibTest return $objects; } + /** + * Get list test. + * + * @param string $orderBy + * @param mixed $pager + * @access public + * @return void + */ public function getListTest($orderBy = 'id_desc', $pager = null) { $objects = $this->objectModel->getList($orderBy, $pager); @@ -74,6 +127,13 @@ class caselibTest return $objects; } + /** + * Create test. + * + * @param mixed $param + * @access public + * @return void + */ public function createTest($param) { foreach($param as $k => $v) $_POST[$k] = $v; @@ -87,6 +147,18 @@ class caselibTest return $objects; } + /** + * Get libcases test. + * + * @param mixed $libID + * @param mixed $browseType + * @param int $queryID + * @param int $moduleID + * @param string $sort + * @param mixed $pager + * @access public + * @return void + */ public function getLibCasesTest($libID, $browseType, $queryID = 0, $moduleID = 0, $sort = 'id_desc', $pager = null) { $objects = $this->objectModel->getLibCases($libID, $browseType, $queryID, $moduleID, $sort, $pager); @@ -96,6 +168,16 @@ class caselibTest return $objects; } + /** + * Build searchform test. + * + * @param mixed $libID + * @param mixed $libraries + * @param mixed $queryID + * @param mixed $actionURL + * @access public + * @return void + */ public function buildSearchFormTest($libID, $libraries, $queryID, $actionURL) { $objects = $this->objectModel->buildSearchForm($libID, $libraries, $queryID, $actionURL); @@ -105,6 +187,15 @@ class caselibTest return $objects; } + /** + * Get liblink test. + * + * @param mixed $module + * @param mixed $method + * @param mixed $extra + * @access public + * @return void + */ public function getLibLinkTest($module, $method, $extra) { $objects = $this->objectModel->getLibLink($module, $method, $extra); @@ -114,6 +205,13 @@ class caselibTest return $objects; } + /** + * Create from import test. + * + * @param mixed $libID + * @access public + * @return void + */ public function createFromImportTest($libID) { $objects = $this->objectModel->createFromImport($libID); @@ -123,6 +221,13 @@ class caselibTest return $objects; } + /** + * Batch create case test. + * + * @param mixed $libID + * @access public + * @return void + */ public function batchCreateCaseTest($libID) { $objects = $this->objectModel->batchCreateCase($libID); diff --git a/test/class/cron.class.php b/test/class/cron.class.php new file mode 100644 index 0000000000..ae7fefe66d --- /dev/null +++ b/test/class/cron.class.php @@ -0,0 +1,254 @@ +objectModel = $tester->loadModel('cron'); + } + + /** + * Get by id test. + * + * @param int $cronID + * @access public + * @return object + */ + public function getByIdTest($cronID) + { + $objects = $this->objectModel->getById($cronID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get crons test. + * + * @param string $params + * @access public + * @return array + */ + public function getCronsTest($params = '') + { + $objects = $this->objectModel->getCrons($params); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Parse crons test. + * + * @param array $crons + * @access public + * @return array + */ + public function parseCronTest($crons) + { + $objects = $this->objectModel->parseCron($crons); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status test. + * + * @param int $cronID + * @param string $status + * @param bool $changeTime + * @access public + * @return bool + */ + public function changeStatusTest($cronID, $status, $changeTime = false) + { + $objects = $this->objectModel->changeStatus($cronID, $status, $changeTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status to running test. + * + * @param int $cronID + * @param string $lastTime + * @access public + * @return bool|int + */ + public function changeStatusRunningTest($cronID, $lastTime) + { + $objects = $this->objectModel->changeStatusRunning($cronID, $lastTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Log cron test. + * + * @param string $log + * @access public + * @return void + */ + public function logCronTest($log) + { + $objects = $this->objectModel->logCron($log); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get last execed time test. + * + * @access public + * @return string + */ + public function getLastTimeTest() + { + $objects = $this->objectModel->getLastTime(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Runable cron test. + * + * @access public + * @return bool + */ + public function runableTest() + { + $objects = $this->objectModel->runable(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Check change cron test. + * + * @access public + * @return bool + */ + public function checkChangeTest() + { + $objects = $this->objectModel->checkChange(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Create cron test. + * + * @param array $param + * @access public + * @return int + */ + public function createTest($param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $cronID = $this->objectModel->create(); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Update cron test. + * + * @param int $cronID + * @access public + * @return bool + */ + public function updateTest($cronID, $param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $objects = $this->objectModel->update($cronID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Check cron rule test. + * + * @param object $cron + * @access public + * @return string + */ + public function checkRuleTest($cron) + { + $objects = $this->objectModel->checkRule($cron); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Mark cron status test. + * + * @param mixed $status + * @param int $configID + * @access public + * @return void + */ + public function markCronStatusTest($status, $configID = 0) + { + $objects = $this->objectModel->markCronStatus($status, $configID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get config id test. + * + * @access public + * @return void + */ + public function getConfigIDTest() + { + $objects = $this->objectModel->getConfigID(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get current cron status test. + * + * @access public + * @return int + */ + public function getTurnonTest() + { + $objects = $this->objectModel->getTurnon(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/cron/changestatus.php b/test/model/cron/changestatus.php new file mode 100644 index 0000000000..0cc56a16f4 --- /dev/null +++ b/test/model/cron/changestatus.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$status = 'stop'; +$result = $cron->changeStatusTest($cronID,$status); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); //更新定时任务状态之后查看返回值 +r($cronInfo) && p('status') && e('stop'); //更新定时任务状态之后查看状态值 + +system('./ztest init'); diff --git a/test/model/cron/changestatusrunning.php b/test/model/cron/changestatusrunning.php new file mode 100644 index 0000000000..133ef80b9a --- /dev/null +++ b/test/model/cron/changestatusrunning.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatusRunning(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 4; +$lastTime = '0000-00-00 00:00:00'; +$result = $cron->changeStatusRunningTest($cronID, $lastTime); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); // 更新之后查看返回值是否是1 +r($cronInfo) && p('status') && e('running'); // 更新之后查看状态值是否是running + +system('./ztest init'); diff --git a/test/model/cron/checkchange.php b/test/model/cron/checkchange.php new file mode 100644 index 0000000000..9307c2cf22 --- /dev/null +++ b/test/model/cron/checkchange.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +checkChange(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +r($cron->checkChangeTest()) && p() && e('1'); //判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 diff --git a/test/model/cron/checkrule.php b/test/model/cron/checkrule.php new file mode 100644 index 0000000000..f3b893afb0 --- /dev/null +++ b/test/model/cron/checkrule.php @@ -0,0 +1,46 @@ +#!/usr/bin/env php +checkRule(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55x'; +$res1 = $cron->checkRuleTest($cron1); + +$cron1->m = '55'; +$cron1->h = '23x'; +$res2 = $cron->checkRuleTest($cron1); + +$cron1->h = '23'; +$cron1->dom = '30x'; +$res3 = $cron->checkRuleTest($cron1); + +$cron1->dom = '30'; +$cron1->mon = '12x'; +$res4 = $cron->checkRuleTest($cron1); + +$cron1->mon = '12'; +$cron1->dow = '6x'; +$res5 = $cron->checkRuleTest($cron1); + +$cron1->dow = '6'; +$cron1->command = ''; +$res6 = $cron->checkRuleTest($cron1); + +r($res1) && p() && e('"分" 填写的不是合法的值'); // 定时任务'分'填写不正确情况 +r($res2) && p() && e('"小时" 填写的不是合法的值') // 定时任务'小时'填写不正确情况 +r($res3) && p() && e('"天" 填写的不是合法的值'); // 定时任务'天'填写不正确情况 +r($res4) && p() && e('"月" 填写的不是合法的值'); // 定时任务'月'填写不正确情况 +r($res5) && p() && e('"周" 填写的不是合法的值'); // 定时任务'周'填写不正确情况 +r($res6) && p() && e('『命令』不能为空。'); // 定时任务'命令'填写不正确情况 + diff --git a/test/model/cron/create.php b/test/model/cron/create.php new file mode 100644 index 0000000000..208b418dd9 --- /dev/null +++ b/test/model/cron/create.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->createTest($cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->createTest($cron1); + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//添加之后对比添加数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //添加之后对比添加数据信息 + +system('./ztest init'); diff --git a/test/model/cron/getbyid.php b/test/model/cron/getbyid.php new file mode 100644 index 0000000000..72643ba684 --- /dev/null +++ b/test/model/cron/getbyid.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getById(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronInfo1 = $cron->getByIdTest(2); +$cronInfo2 = $cron->getByIdTest(16); + +r($cronInfo1) && p('command,remark,m,h,status') && e('moduleName=execution&methodName=computeburn,更新燃尽图,30,23,normal'); //获取ID为2的定时的命令,备注,分,时 +r($cronInfo2) && p('command,remark,m,h,status') && e('moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop'); //获取ID为16的定时的命令,备注,分,时 diff --git a/test/model/cron/getconfigid.php b/test/model/cron/getconfigid.php new file mode 100644 index 0000000000..3f575037df --- /dev/null +++ b/test/model/cron/getconfigid.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getConfigID(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $cron->getConfigIDTest(); + +r($id) && p() && e('19'); //查询cron的configID,目前内置的是19 diff --git a/test/model/cron/getcrons.php b/test/model/cron/getcrons.php new file mode 100644 index 0000000000..f54edad96c --- /dev/null +++ b/test/model/cron/getcrons.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getCrons(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$list = $cron->getCronsTest(); +$noStopList = $cron->getCronsTest('nostop'); + +r(count($list)) && p() && e('19'); // 没有筛选条件时候,获取所有定时任务 +r(count($noStopList)) && p() && e('16'); // 有筛选条件时候,获取定时任务 +r($list) && p('12:remark,command') && e('同步Jenkins任务状态,moduleName=ci&methodName=checkCompileStatus'); // 获取某个定时任务的信息 diff --git a/test/model/cron/getlasttime.php b/test/model/cron/getlasttime.php new file mode 100644 index 0000000000..385076195a --- /dev/null +++ b/test/model/cron/getlasttime.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getLastTime(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$lastTime = $cron->getLastTimeTest(); + +r($lastTime) && p() && e('2022-04-01 13:42:45'); //获取最后执行时间进行对比 diff --git a/test/model/cron/getturnon.php b/test/model/cron/getturnon.php new file mode 100644 index 0000000000..305bb6502b --- /dev/null +++ b/test/model/cron/getturnon.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getTurnon(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$value = $cron->getTurnonTest(); + +r($value) && p() && e('1'); //查询定时任务配置是否开启 diff --git a/test/model/cron/logcron.php b/test/model/cron/logcron.php new file mode 100644 index 0000000000..0d51e9175e --- /dev/null +++ b/test/model/cron/logcron.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +logCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$file = $tester->app->getLogRoot() . 'cron.' . date('Ymd') . '.log.php'; +if(is_file($file)) unlink($file); + +$cron->logCronTest('cronlogtest'); +$info = file_get_contents($file); +$strExists = strpos($info,'cronlogtest'); + +r($strExists) && p() && e('14');// 调用日志方法查看日志文件该字符串位置 diff --git a/test/model/cron/markcronstatus.php b/test/model/cron/markcronstatus.php new file mode 100644 index 0000000000..050af6a8c9 --- /dev/null +++ b/test/model/cron/markcronstatus.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +markCronStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $tester->cron->getConfigID(); +$configID = $cron->markCronStatusTest('stop', $id); +$config1 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->delete()->from(TABLE_CONFIG)->where('id')->eq($configID)->exec(); +$configID = $cron->markCronStatusTest('run'); +$config2 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->update(TABLE_CONFIG)->set('id')->eq($id)->where('id')->eq($configID)->exec(); + +r($config1) && p('value') && e('stop'); //修改配置项之后查看更新信息 +r($config2) && p('value') && e('run'); //修改配置项之后查看更新信息 + +system('./ztest init'); diff --git a/test/model/cron/parsecron.php b/test/model/cron/parsecron.php new file mode 100644 index 0000000000..bfcb7151ab --- /dev/null +++ b/test/model/cron/parsecron.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +parseCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$crons = $tester->cron->getCrons('nostop'); +$parse = $cron->parseCronTest($crons); + +r($parse) && p('19:schema,command') && e('*/5 * * * *,moduleName=measurement&methodName=execCrontabQueue');//获取id为19的定时任务的定时信息和命令信息 +r($parse) && p('15:schema,command') && e('30 23 * * *,moduleName=execution&methodName=computeTaskEffort'); //获取id为15的定时任务的定时信息和命令信息 + +system('./ztest init'); diff --git a/test/model/cron/runable.php b/test/model/cron/runable.php new file mode 100644 index 0000000000..8e39324edf --- /dev/null +++ b/test/model/cron/runable.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +runable(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +$tester->config->global->cron = 0; +$res1 = $cron->runableTest(); + +$tester->config->global->cron = 1; +$res2 = $cron->runableTest(); + +$tester->config->cron->maxRunTime = PHP_INT_MAX; +unset($tester->config->cron->run->status); +$res3 = $cron->runableTest(); + +$tester->config->cron->run->status = 'stop'; +$res4 = $cron->runableTest(); + +$tester->config->cron->run->status = 'running'; +$res5 = $cron->runableTest(); + +r($res1) && p() && e('0'); //cron配置为空情况 +r($res2) && p() && e('1'); //cron配置存在,执行时间大于最大可执行时间情况 +r($res3) && p() && e('1'); //cron状态为空情况 +r($res4) && p() && e('1'); //cron状态是stop情况 +r($res5) && p() && e('0'); //cron状态存在不是stop情况 diff --git a/test/model/cron/update.php b/test/model/cron/update.php new file mode 100644 index 0000000000..f89fdfda33 --- /dev/null +++ b/test/model/cron/update.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->updateTest($cronID, $cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->updateTest($cronID, $cron1); + + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//更新之后对比更新数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //更新之后对比更新数据信息 + +system('./ztest init'); diff --git a/test/ztest b/test/ztest index 0eacb5393e..e2751a5993 100755 --- a/test/ztest +++ b/test/ztest @@ -58,6 +58,12 @@ switch($argv[1]) case 'kanban': ztfRun('model/kanban'); break; + case 'caselib': + ztfRun('model/caselib'); + break; + case 'cron': + ztfRun('model/cron'); + break; case 'model': ztfRun('model'); break; From d3c83b5fa25606a3770f74a372780a74d15e2964 Mon Sep 17 00:00:00 2001 From: denghongtao Date: Sat, 2 Apr 2022 11:58:39 +0800 Subject: [PATCH 02/39] add productsonplan zendate --- .../{productsunplan.yaml => productsonplan.yaml} | 0 test/data/zentao/config.php | 1 + test/data/zentao/processor.php | 14 ++++++++++++++ 3 files changed, 15 insertions(+) rename test/data/{productsunplan.yaml => productsonplan.yaml} (100%) diff --git a/test/data/productsunplan.yaml b/test/data/productsonplan.yaml similarity index 100% rename from test/data/productsunplan.yaml rename to test/data/productsonplan.yaml diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index f6927366b9..628cdfbb2f 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -48,6 +48,7 @@ $builder->product = array('rows' => 100, 'extends' => array('product $builder->productalone = array('rows' => 20, 'extends' => array('product','productalone')); $builder->productline = array('rows' => 20, 'extends' => array('module', 'productline')); $builder->productplan = array('rows' => 70, 'extends' => array('productplan')); +$builder->productsonplan = array('rows' => 10, 'extends' => array('productplan', 'productsonplan')); $builder->branch = array('rows' => 240, 'extends' => array('branch')); $builder->projectproduct = array('rows' => 200, 'extends' => array('projectproduct')); $builder->projectproductalone = array('rows' => 28, 'extends' => array('projectproduct','projectproductalone')); diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index e22b9f38e6..e75e4f3e14 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -50,6 +50,7 @@ class Processor $this->initBug(); $this->initTest(); $this->initTodo(); + $this->initSonPlan(); $this->dao->commit(); } @@ -418,4 +419,17 @@ class Processor $this->dao->query("update zt_kanbancell set `cards` = ',184,185,186,' where id = 439"); $this->dao->query("update zt_kanbancell set `cards` = ',62,' where id = 448"); } + + /** + * Init son plan + * + * @access public + * @return void + */ + public function initSonPlan() + { + $this->dao->query("update zt_productplan set `parent` = '-1' where id < 10 and id > 0"); + + } + } From c2b4f5d8b3c9a81a2316f5ec98c5111ee8a67e03 Mon Sep 17 00:00:00 2001 From: zhangxuwen Date: Sat, 2 Apr 2022 11:05:40 +0800 Subject: [PATCH 03/39] auto test cron model --- test/class/caselib.class.php | 105 ++++++++++ test/class/cron.class.php | 254 ++++++++++++++++++++++++ test/model/cron/changestatus.php | 24 +++ test/model/cron/changestatusrunning.php | 24 +++ test/model/cron/checkchange.php | 17 ++ test/model/cron/checkrule.php | 46 +++++ test/model/cron/create.php | 34 ++++ test/model/cron/getbyid.php | 20 ++ test/model/cron/getconfigid.php | 18 ++ test/model/cron/getcrons.php | 21 ++ test/model/cron/getlasttime.php | 18 ++ test/model/cron/getturnon.php | 18 ++ test/model/cron/logcron.php | 23 +++ test/model/cron/markcronstatus.php | 29 +++ test/model/cron/parsecron.php | 22 ++ test/model/cron/runable.php | 37 ++++ test/model/cron/update.php | 36 ++++ test/ztest | 6 + 18 files changed, 752 insertions(+) create mode 100644 test/class/cron.class.php create mode 100644 test/model/cron/changestatus.php create mode 100644 test/model/cron/changestatusrunning.php create mode 100644 test/model/cron/checkchange.php create mode 100644 test/model/cron/checkrule.php create mode 100644 test/model/cron/create.php create mode 100644 test/model/cron/getbyid.php create mode 100644 test/model/cron/getconfigid.php create mode 100644 test/model/cron/getcrons.php create mode 100644 test/model/cron/getlasttime.php create mode 100644 test/model/cron/getturnon.php create mode 100644 test/model/cron/logcron.php create mode 100644 test/model/cron/markcronstatus.php create mode 100644 test/model/cron/parsecron.php create mode 100644 test/model/cron/runable.php create mode 100644 test/model/cron/update.php diff --git a/test/class/caselib.class.php b/test/class/caselib.class.php index 3c7ce07afc..19523316be 100644 --- a/test/class/caselib.class.php +++ b/test/class/caselib.class.php @@ -7,6 +7,14 @@ class caselibTest $this->objectModel = $tester->loadModel('caselib'); } + /** + * Set lib menu test. + * + * @param mixed $libraries + * @param mixed $libID + * @access public + * @return void + */ public function setLibMenuTest($libraries, $libID) { $objects = $this->objectModel->setLibMenu($libraries, $libID); @@ -16,6 +24,14 @@ class caselibTest return $objects; } + /** + * Save lib state test. + * + * @param int $libID + * @param array $libraries + * @access public + * @return void + */ public function saveLibStateTest($libID = 0, $libraries = array()) { $objects = $this->objectModel->saveLibState($libID, $libraries); @@ -25,6 +41,14 @@ class caselibTest return $objects; } + /** + * Get by ID test. + * + * @param mixed $libID + * @param mixed $setImgSize + * @access public + * @return void + */ public function getByIdTest($libID, $setImgSize = false) { $objects = $this->objectModel->getById($libID, $setImgSize); @@ -34,6 +58,13 @@ class caselibTest return $objects; } + /** + * Update test. + * + * @param mixed $libID + * @access public + * @return void + */ public function updateTest($libID) { $objects = $this->objectModel->update($libID); @@ -45,6 +76,14 @@ class caselibTest return $objects; } + /** + * Delete test. + * + * @param mixed $libID + * @param string $table + * @access public + * @return void + */ public function deleteTest($libID, $table = '') { $objects = $this->objectModel->delete($libID, $table); @@ -56,6 +95,12 @@ class caselibTest return $objects; } + /** + * Get libraries test. + * + * @access public + * @return void + */ public function getLibrariesTest() { $objects = $this->objectModel->getLibraries(); @@ -65,6 +110,14 @@ class caselibTest return $objects; } + /** + * Get list test. + * + * @param string $orderBy + * @param mixed $pager + * @access public + * @return void + */ public function getListTest($orderBy = 'id_desc', $pager = null) { $objects = $this->objectModel->getList($orderBy, $pager); @@ -74,6 +127,13 @@ class caselibTest return $objects; } + /** + * Create test. + * + * @param mixed $param + * @access public + * @return void + */ public function createTest($param) { foreach($param as $k => $v) $_POST[$k] = $v; @@ -87,6 +147,18 @@ class caselibTest return $objects; } + /** + * Get libcases test. + * + * @param mixed $libID + * @param mixed $browseType + * @param int $queryID + * @param int $moduleID + * @param string $sort + * @param mixed $pager + * @access public + * @return void + */ public function getLibCasesTest($libID, $browseType, $queryID = 0, $moduleID = 0, $sort = 'id_desc', $pager = null) { $objects = $this->objectModel->getLibCases($libID, $browseType, $queryID, $moduleID, $sort, $pager); @@ -96,6 +168,16 @@ class caselibTest return $objects; } + /** + * Build searchform test. + * + * @param mixed $libID + * @param mixed $libraries + * @param mixed $queryID + * @param mixed $actionURL + * @access public + * @return void + */ public function buildSearchFormTest($libID, $libraries, $queryID, $actionURL) { $objects = $this->objectModel->buildSearchForm($libID, $libraries, $queryID, $actionURL); @@ -105,6 +187,15 @@ class caselibTest return $objects; } + /** + * Get liblink test. + * + * @param mixed $module + * @param mixed $method + * @param mixed $extra + * @access public + * @return void + */ public function getLibLinkTest($module, $method, $extra) { $objects = $this->objectModel->getLibLink($module, $method, $extra); @@ -114,6 +205,13 @@ class caselibTest return $objects; } + /** + * Create from import test. + * + * @param mixed $libID + * @access public + * @return void + */ public function createFromImportTest($libID) { $objects = $this->objectModel->createFromImport($libID); @@ -123,6 +221,13 @@ class caselibTest return $objects; } + /** + * Batch create case test. + * + * @param mixed $libID + * @access public + * @return void + */ public function batchCreateCaseTest($libID) { $objects = $this->objectModel->batchCreateCase($libID); diff --git a/test/class/cron.class.php b/test/class/cron.class.php new file mode 100644 index 0000000000..ae7fefe66d --- /dev/null +++ b/test/class/cron.class.php @@ -0,0 +1,254 @@ +objectModel = $tester->loadModel('cron'); + } + + /** + * Get by id test. + * + * @param int $cronID + * @access public + * @return object + */ + public function getByIdTest($cronID) + { + $objects = $this->objectModel->getById($cronID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get crons test. + * + * @param string $params + * @access public + * @return array + */ + public function getCronsTest($params = '') + { + $objects = $this->objectModel->getCrons($params); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Parse crons test. + * + * @param array $crons + * @access public + * @return array + */ + public function parseCronTest($crons) + { + $objects = $this->objectModel->parseCron($crons); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status test. + * + * @param int $cronID + * @param string $status + * @param bool $changeTime + * @access public + * @return bool + */ + public function changeStatusTest($cronID, $status, $changeTime = false) + { + $objects = $this->objectModel->changeStatus($cronID, $status, $changeTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status to running test. + * + * @param int $cronID + * @param string $lastTime + * @access public + * @return bool|int + */ + public function changeStatusRunningTest($cronID, $lastTime) + { + $objects = $this->objectModel->changeStatusRunning($cronID, $lastTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Log cron test. + * + * @param string $log + * @access public + * @return void + */ + public function logCronTest($log) + { + $objects = $this->objectModel->logCron($log); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get last execed time test. + * + * @access public + * @return string + */ + public function getLastTimeTest() + { + $objects = $this->objectModel->getLastTime(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Runable cron test. + * + * @access public + * @return bool + */ + public function runableTest() + { + $objects = $this->objectModel->runable(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Check change cron test. + * + * @access public + * @return bool + */ + public function checkChangeTest() + { + $objects = $this->objectModel->checkChange(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Create cron test. + * + * @param array $param + * @access public + * @return int + */ + public function createTest($param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $cronID = $this->objectModel->create(); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Update cron test. + * + * @param int $cronID + * @access public + * @return bool + */ + public function updateTest($cronID, $param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $objects = $this->objectModel->update($cronID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Check cron rule test. + * + * @param object $cron + * @access public + * @return string + */ + public function checkRuleTest($cron) + { + $objects = $this->objectModel->checkRule($cron); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Mark cron status test. + * + * @param mixed $status + * @param int $configID + * @access public + * @return void + */ + public function markCronStatusTest($status, $configID = 0) + { + $objects = $this->objectModel->markCronStatus($status, $configID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get config id test. + * + * @access public + * @return void + */ + public function getConfigIDTest() + { + $objects = $this->objectModel->getConfigID(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get current cron status test. + * + * @access public + * @return int + */ + public function getTurnonTest() + { + $objects = $this->objectModel->getTurnon(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/cron/changestatus.php b/test/model/cron/changestatus.php new file mode 100644 index 0000000000..0cc56a16f4 --- /dev/null +++ b/test/model/cron/changestatus.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$status = 'stop'; +$result = $cron->changeStatusTest($cronID,$status); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); //更新定时任务状态之后查看返回值 +r($cronInfo) && p('status') && e('stop'); //更新定时任务状态之后查看状态值 + +system('./ztest init'); diff --git a/test/model/cron/changestatusrunning.php b/test/model/cron/changestatusrunning.php new file mode 100644 index 0000000000..133ef80b9a --- /dev/null +++ b/test/model/cron/changestatusrunning.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatusRunning(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 4; +$lastTime = '0000-00-00 00:00:00'; +$result = $cron->changeStatusRunningTest($cronID, $lastTime); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); // 更新之后查看返回值是否是1 +r($cronInfo) && p('status') && e('running'); // 更新之后查看状态值是否是running + +system('./ztest init'); diff --git a/test/model/cron/checkchange.php b/test/model/cron/checkchange.php new file mode 100644 index 0000000000..9307c2cf22 --- /dev/null +++ b/test/model/cron/checkchange.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +checkChange(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +r($cron->checkChangeTest()) && p() && e('1'); //判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 diff --git a/test/model/cron/checkrule.php b/test/model/cron/checkrule.php new file mode 100644 index 0000000000..f3b893afb0 --- /dev/null +++ b/test/model/cron/checkrule.php @@ -0,0 +1,46 @@ +#!/usr/bin/env php +checkRule(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55x'; +$res1 = $cron->checkRuleTest($cron1); + +$cron1->m = '55'; +$cron1->h = '23x'; +$res2 = $cron->checkRuleTest($cron1); + +$cron1->h = '23'; +$cron1->dom = '30x'; +$res3 = $cron->checkRuleTest($cron1); + +$cron1->dom = '30'; +$cron1->mon = '12x'; +$res4 = $cron->checkRuleTest($cron1); + +$cron1->mon = '12'; +$cron1->dow = '6x'; +$res5 = $cron->checkRuleTest($cron1); + +$cron1->dow = '6'; +$cron1->command = ''; +$res6 = $cron->checkRuleTest($cron1); + +r($res1) && p() && e('"分" 填写的不是合法的值'); // 定时任务'分'填写不正确情况 +r($res2) && p() && e('"小时" 填写的不是合法的值') // 定时任务'小时'填写不正确情况 +r($res3) && p() && e('"天" 填写的不是合法的值'); // 定时任务'天'填写不正确情况 +r($res4) && p() && e('"月" 填写的不是合法的值'); // 定时任务'月'填写不正确情况 +r($res5) && p() && e('"周" 填写的不是合法的值'); // 定时任务'周'填写不正确情况 +r($res6) && p() && e('『命令』不能为空。'); // 定时任务'命令'填写不正确情况 + diff --git a/test/model/cron/create.php b/test/model/cron/create.php new file mode 100644 index 0000000000..208b418dd9 --- /dev/null +++ b/test/model/cron/create.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->createTest($cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->createTest($cron1); + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//添加之后对比添加数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //添加之后对比添加数据信息 + +system('./ztest init'); diff --git a/test/model/cron/getbyid.php b/test/model/cron/getbyid.php new file mode 100644 index 0000000000..72643ba684 --- /dev/null +++ b/test/model/cron/getbyid.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getById(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronInfo1 = $cron->getByIdTest(2); +$cronInfo2 = $cron->getByIdTest(16); + +r($cronInfo1) && p('command,remark,m,h,status') && e('moduleName=execution&methodName=computeburn,更新燃尽图,30,23,normal'); //获取ID为2的定时的命令,备注,分,时 +r($cronInfo2) && p('command,remark,m,h,status') && e('moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop'); //获取ID为16的定时的命令,备注,分,时 diff --git a/test/model/cron/getconfigid.php b/test/model/cron/getconfigid.php new file mode 100644 index 0000000000..3f575037df --- /dev/null +++ b/test/model/cron/getconfigid.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getConfigID(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $cron->getConfigIDTest(); + +r($id) && p() && e('19'); //查询cron的configID,目前内置的是19 diff --git a/test/model/cron/getcrons.php b/test/model/cron/getcrons.php new file mode 100644 index 0000000000..f54edad96c --- /dev/null +++ b/test/model/cron/getcrons.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getCrons(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$list = $cron->getCronsTest(); +$noStopList = $cron->getCronsTest('nostop'); + +r(count($list)) && p() && e('19'); // 没有筛选条件时候,获取所有定时任务 +r(count($noStopList)) && p() && e('16'); // 有筛选条件时候,获取定时任务 +r($list) && p('12:remark,command') && e('同步Jenkins任务状态,moduleName=ci&methodName=checkCompileStatus'); // 获取某个定时任务的信息 diff --git a/test/model/cron/getlasttime.php b/test/model/cron/getlasttime.php new file mode 100644 index 0000000000..385076195a --- /dev/null +++ b/test/model/cron/getlasttime.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getLastTime(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$lastTime = $cron->getLastTimeTest(); + +r($lastTime) && p() && e('2022-04-01 13:42:45'); //获取最后执行时间进行对比 diff --git a/test/model/cron/getturnon.php b/test/model/cron/getturnon.php new file mode 100644 index 0000000000..305bb6502b --- /dev/null +++ b/test/model/cron/getturnon.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getTurnon(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$value = $cron->getTurnonTest(); + +r($value) && p() && e('1'); //查询定时任务配置是否开启 diff --git a/test/model/cron/logcron.php b/test/model/cron/logcron.php new file mode 100644 index 0000000000..0d51e9175e --- /dev/null +++ b/test/model/cron/logcron.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +logCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$file = $tester->app->getLogRoot() . 'cron.' . date('Ymd') . '.log.php'; +if(is_file($file)) unlink($file); + +$cron->logCronTest('cronlogtest'); +$info = file_get_contents($file); +$strExists = strpos($info,'cronlogtest'); + +r($strExists) && p() && e('14');// 调用日志方法查看日志文件该字符串位置 diff --git a/test/model/cron/markcronstatus.php b/test/model/cron/markcronstatus.php new file mode 100644 index 0000000000..050af6a8c9 --- /dev/null +++ b/test/model/cron/markcronstatus.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +markCronStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $tester->cron->getConfigID(); +$configID = $cron->markCronStatusTest('stop', $id); +$config1 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->delete()->from(TABLE_CONFIG)->where('id')->eq($configID)->exec(); +$configID = $cron->markCronStatusTest('run'); +$config2 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->update(TABLE_CONFIG)->set('id')->eq($id)->where('id')->eq($configID)->exec(); + +r($config1) && p('value') && e('stop'); //修改配置项之后查看更新信息 +r($config2) && p('value') && e('run'); //修改配置项之后查看更新信息 + +system('./ztest init'); diff --git a/test/model/cron/parsecron.php b/test/model/cron/parsecron.php new file mode 100644 index 0000000000..bfcb7151ab --- /dev/null +++ b/test/model/cron/parsecron.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +parseCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$crons = $tester->cron->getCrons('nostop'); +$parse = $cron->parseCronTest($crons); + +r($parse) && p('19:schema,command') && e('*/5 * * * *,moduleName=measurement&methodName=execCrontabQueue');//获取id为19的定时任务的定时信息和命令信息 +r($parse) && p('15:schema,command') && e('30 23 * * *,moduleName=execution&methodName=computeTaskEffort'); //获取id为15的定时任务的定时信息和命令信息 + +system('./ztest init'); diff --git a/test/model/cron/runable.php b/test/model/cron/runable.php new file mode 100644 index 0000000000..8e39324edf --- /dev/null +++ b/test/model/cron/runable.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +runable(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +$tester->config->global->cron = 0; +$res1 = $cron->runableTest(); + +$tester->config->global->cron = 1; +$res2 = $cron->runableTest(); + +$tester->config->cron->maxRunTime = PHP_INT_MAX; +unset($tester->config->cron->run->status); +$res3 = $cron->runableTest(); + +$tester->config->cron->run->status = 'stop'; +$res4 = $cron->runableTest(); + +$tester->config->cron->run->status = 'running'; +$res5 = $cron->runableTest(); + +r($res1) && p() && e('0'); //cron配置为空情况 +r($res2) && p() && e('1'); //cron配置存在,执行时间大于最大可执行时间情况 +r($res3) && p() && e('1'); //cron状态为空情况 +r($res4) && p() && e('1'); //cron状态是stop情况 +r($res5) && p() && e('0'); //cron状态存在不是stop情况 diff --git a/test/model/cron/update.php b/test/model/cron/update.php new file mode 100644 index 0000000000..f89fdfda33 --- /dev/null +++ b/test/model/cron/update.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->updateTest($cronID, $cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->updateTest($cronID, $cron1); + + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//更新之后对比更新数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //更新之后对比更新数据信息 + +system('./ztest init'); diff --git a/test/ztest b/test/ztest index e2b1377185..9acae923fd 100755 --- a/test/ztest +++ b/test/ztest @@ -61,6 +61,12 @@ switch($argv[1]) case 'my': ztfRun('model/my'); break; + case 'caselib': + ztfRun('model/caselib'); + break; + case 'cron': + ztfRun('model/cron'); + break; case 'model': ztfRun('model'); break; From bbb19ac18399b29a5ace34de3e9f7aeff81163d9 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Sat, 2 Apr 2022 15:31:07 +0800 Subject: [PATCH 04/39] * Fix bug #20793. --- module/story/control.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index fcde54748b..712dc61afa 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2364,7 +2364,7 @@ class story extends control $relatedBranchIdList[$story->branch] = $story->branch; $relatedStoryIds[$story->id] = $story->id; - if(isset($relations[$story->id])) $story->linkStories = $story->linkStories . ',' . $relations[$story->id]; + if(isset($relations[$story->id])) $story->childStories = $story->childStories . ',' . $relations[$story->id]; /* Process related stories. */ $relatedStories = $story->childStories . ',' . $story->linkStories . ',' . $story->duplicateStory; @@ -2455,8 +2455,6 @@ class story extends control $linkStoriesIdList = explode(',', $story->linkStories); foreach($linkStoriesIdList as $linkStoryID) { - if(empty($linkStoryID)) continue; - $linkStoryID = trim($linkStoryID); $tmpLinkStories[] = isset($relatedStories[$linkStoryID]) ? $relatedStories[$linkStoryID] : $linkStoryID; } @@ -2469,6 +2467,8 @@ class story extends control $childStoriesIdList = explode(',', $story->childStories); foreach($childStoriesIdList as $childStoryID) { + if(empty($childStoryID)) continue; + $childStoryID = trim($childStoryID); $tmpChildStories[] = isset($relatedStories[$childStoryID]) ? $relatedStories[$childStoryID] : $childStoryID; } From 025a6f32b0960bfa9fda1d1ad25461a7ec029d30 Mon Sep 17 00:00:00 2001 From: Hao Sun Date: Sat, 2 Apr 2022 16:25:02 +0800 Subject: [PATCH 05/39] * bug #18928, fix switch button not work when statistic block place in right side. --- module/block/view/executionstatisticblock.html.php | 4 ++-- module/block/view/productstatisticblock.html.php | 4 ++-- module/block/view/projectstatisticblock.html.php | 4 ++-- module/block/view/qastatisticblock.html.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/block/view/executionstatisticblock.html.php b/module/block/view/executionstatisticblock.html.php index d36a100a9b..bc8168dd0c 100644 --- a/module/block/view/executionstatisticblock.html.php +++ b/module/block/view/executionstatisticblock.html.php @@ -69,8 +69,8 @@ $(function() var isPrev = $(this).is('.prev'); var $activeItem = $nav.children('.active'); var $next = $activeItem[isPrev ? 'prev' : 'next']('li:not(.switch-icon)'); - if ($next.length) $next.find('a').trigger('click'); - else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a').trigger('click'); + if ($next.length) $next.find('a[data-toggle="tab"]').trigger('click'); + else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a[data-toggle="tab"]').trigger('click'); e.preventDefault(); }); diff --git a/module/block/view/productstatisticblock.html.php b/module/block/view/productstatisticblock.html.php index 393332b0ef..7da3cd7d4e 100644 --- a/module/block/view/productstatisticblock.html.php +++ b/module/block/view/productstatisticblock.html.php @@ -84,8 +84,8 @@ $(function() var isPrev = $(this).is('.prev'); var $activeItem = $nav.children('.active'); var $next = $activeItem[isPrev ? 'prev' : 'next']('li:not(.switch-icon)'); - if ($next.length) $next.find('a').trigger('click'); - else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a').trigger('click'); + if ($next.length) $next.find('a[data-toggle="tab"]').trigger('click'); + else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a[data-toggle="tab"]').trigger('click'); e.preventDefault(); }); diff --git a/module/block/view/projectstatisticblock.html.php b/module/block/view/projectstatisticblock.html.php index a64091dab3..20f6c9991f 100644 --- a/module/block/view/projectstatisticblock.html.php +++ b/module/block/view/projectstatisticblock.html.php @@ -97,8 +97,8 @@ $(function() var isPrev = $(this).is('.prev'); var $activeItem = $nav.children('.active'); var $next = $activeItem[isPrev ? 'prev' : 'next']('li:not(.switch-icon)'); - if ($next.length) $next.find('a').trigger('click'); - else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a').trigger('click'); + if ($next.length) $next.find('a[data-toggle="tab"]').trigger('click'); + else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a[data-toggle="tab"]').trigger('click'); e.preventDefault(); }); diff --git a/module/block/view/qastatisticblock.html.php b/module/block/view/qastatisticblock.html.php index 65d5142742..5d4085d837 100644 --- a/module/block/view/qastatisticblock.html.php +++ b/module/block/view/qastatisticblock.html.php @@ -69,8 +69,8 @@ $(function() var isPrev = $(this).is('.prev'); var $activeItem = $nav.children('.active'); var $next = $activeItem[isPrev ? 'prev' : 'next']('li:not(.switch-icon)'); - if ($next.length) $next.find('a').trigger('click'); - else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a').trigger('click'); + if ($next.length) $next.find('a[data-toggle="tab"]').trigger('click'); + else $nav.children('li:not(.switch-icon)')[isPrev ? 'last' : 'first']().find('a[data-toggle="tab"]').trigger('click'); e.preventDefault(); }); From a9f4a4ef50d4b29d0cd0b6d193c536e610471dd6 Mon Sep 17 00:00:00 2001 From: zhangxuwen Date: Sat, 2 Apr 2022 11:05:40 +0800 Subject: [PATCH 06/39] auto test cron model --- test/class/caselib.class.php | 105 ++++++++++ test/class/cron.class.php | 254 ++++++++++++++++++++++++ test/model/cron/changestatus.php | 24 +++ test/model/cron/changestatusrunning.php | 24 +++ test/model/cron/checkchange.php | 17 ++ test/model/cron/checkrule.php | 46 +++++ test/model/cron/create.php | 34 ++++ test/model/cron/getbyid.php | 20 ++ test/model/cron/getconfigid.php | 18 ++ test/model/cron/getcrons.php | 21 ++ test/model/cron/getlasttime.php | 18 ++ test/model/cron/getturnon.php | 18 ++ test/model/cron/logcron.php | 23 +++ test/model/cron/markcronstatus.php | 29 +++ test/model/cron/parsecron.php | 22 ++ test/model/cron/runable.php | 37 ++++ test/model/cron/update.php | 36 ++++ test/ztest | 5 + 18 files changed, 751 insertions(+) create mode 100644 test/class/cron.class.php create mode 100644 test/model/cron/changestatus.php create mode 100644 test/model/cron/changestatusrunning.php create mode 100644 test/model/cron/checkchange.php create mode 100644 test/model/cron/checkrule.php create mode 100644 test/model/cron/create.php create mode 100644 test/model/cron/getbyid.php create mode 100644 test/model/cron/getconfigid.php create mode 100644 test/model/cron/getcrons.php create mode 100644 test/model/cron/getlasttime.php create mode 100644 test/model/cron/getturnon.php create mode 100644 test/model/cron/logcron.php create mode 100644 test/model/cron/markcronstatus.php create mode 100644 test/model/cron/parsecron.php create mode 100644 test/model/cron/runable.php create mode 100644 test/model/cron/update.php diff --git a/test/class/caselib.class.php b/test/class/caselib.class.php index 3c7ce07afc..19523316be 100644 --- a/test/class/caselib.class.php +++ b/test/class/caselib.class.php @@ -7,6 +7,14 @@ class caselibTest $this->objectModel = $tester->loadModel('caselib'); } + /** + * Set lib menu test. + * + * @param mixed $libraries + * @param mixed $libID + * @access public + * @return void + */ public function setLibMenuTest($libraries, $libID) { $objects = $this->objectModel->setLibMenu($libraries, $libID); @@ -16,6 +24,14 @@ class caselibTest return $objects; } + /** + * Save lib state test. + * + * @param int $libID + * @param array $libraries + * @access public + * @return void + */ public function saveLibStateTest($libID = 0, $libraries = array()) { $objects = $this->objectModel->saveLibState($libID, $libraries); @@ -25,6 +41,14 @@ class caselibTest return $objects; } + /** + * Get by ID test. + * + * @param mixed $libID + * @param mixed $setImgSize + * @access public + * @return void + */ public function getByIdTest($libID, $setImgSize = false) { $objects = $this->objectModel->getById($libID, $setImgSize); @@ -34,6 +58,13 @@ class caselibTest return $objects; } + /** + * Update test. + * + * @param mixed $libID + * @access public + * @return void + */ public function updateTest($libID) { $objects = $this->objectModel->update($libID); @@ -45,6 +76,14 @@ class caselibTest return $objects; } + /** + * Delete test. + * + * @param mixed $libID + * @param string $table + * @access public + * @return void + */ public function deleteTest($libID, $table = '') { $objects = $this->objectModel->delete($libID, $table); @@ -56,6 +95,12 @@ class caselibTest return $objects; } + /** + * Get libraries test. + * + * @access public + * @return void + */ public function getLibrariesTest() { $objects = $this->objectModel->getLibraries(); @@ -65,6 +110,14 @@ class caselibTest return $objects; } + /** + * Get list test. + * + * @param string $orderBy + * @param mixed $pager + * @access public + * @return void + */ public function getListTest($orderBy = 'id_desc', $pager = null) { $objects = $this->objectModel->getList($orderBy, $pager); @@ -74,6 +127,13 @@ class caselibTest return $objects; } + /** + * Create test. + * + * @param mixed $param + * @access public + * @return void + */ public function createTest($param) { foreach($param as $k => $v) $_POST[$k] = $v; @@ -87,6 +147,18 @@ class caselibTest return $objects; } + /** + * Get libcases test. + * + * @param mixed $libID + * @param mixed $browseType + * @param int $queryID + * @param int $moduleID + * @param string $sort + * @param mixed $pager + * @access public + * @return void + */ public function getLibCasesTest($libID, $browseType, $queryID = 0, $moduleID = 0, $sort = 'id_desc', $pager = null) { $objects = $this->objectModel->getLibCases($libID, $browseType, $queryID, $moduleID, $sort, $pager); @@ -96,6 +168,16 @@ class caselibTest return $objects; } + /** + * Build searchform test. + * + * @param mixed $libID + * @param mixed $libraries + * @param mixed $queryID + * @param mixed $actionURL + * @access public + * @return void + */ public function buildSearchFormTest($libID, $libraries, $queryID, $actionURL) { $objects = $this->objectModel->buildSearchForm($libID, $libraries, $queryID, $actionURL); @@ -105,6 +187,15 @@ class caselibTest return $objects; } + /** + * Get liblink test. + * + * @param mixed $module + * @param mixed $method + * @param mixed $extra + * @access public + * @return void + */ public function getLibLinkTest($module, $method, $extra) { $objects = $this->objectModel->getLibLink($module, $method, $extra); @@ -114,6 +205,13 @@ class caselibTest return $objects; } + /** + * Create from import test. + * + * @param mixed $libID + * @access public + * @return void + */ public function createFromImportTest($libID) { $objects = $this->objectModel->createFromImport($libID); @@ -123,6 +221,13 @@ class caselibTest return $objects; } + /** + * Batch create case test. + * + * @param mixed $libID + * @access public + * @return void + */ public function batchCreateCaseTest($libID) { $objects = $this->objectModel->batchCreateCase($libID); diff --git a/test/class/cron.class.php b/test/class/cron.class.php new file mode 100644 index 0000000000..ae7fefe66d --- /dev/null +++ b/test/class/cron.class.php @@ -0,0 +1,254 @@ +objectModel = $tester->loadModel('cron'); + } + + /** + * Get by id test. + * + * @param int $cronID + * @access public + * @return object + */ + public function getByIdTest($cronID) + { + $objects = $this->objectModel->getById($cronID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get crons test. + * + * @param string $params + * @access public + * @return array + */ + public function getCronsTest($params = '') + { + $objects = $this->objectModel->getCrons($params); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Parse crons test. + * + * @param array $crons + * @access public + * @return array + */ + public function parseCronTest($crons) + { + $objects = $this->objectModel->parseCron($crons); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status test. + * + * @param int $cronID + * @param string $status + * @param bool $changeTime + * @access public + * @return bool + */ + public function changeStatusTest($cronID, $status, $changeTime = false) + { + $objects = $this->objectModel->changeStatus($cronID, $status, $changeTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Change cron status to running test. + * + * @param int $cronID + * @param string $lastTime + * @access public + * @return bool|int + */ + public function changeStatusRunningTest($cronID, $lastTime) + { + $objects = $this->objectModel->changeStatusRunning($cronID, $lastTime); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Log cron test. + * + * @param string $log + * @access public + * @return void + */ + public function logCronTest($log) + { + $objects = $this->objectModel->logCron($log); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get last execed time test. + * + * @access public + * @return string + */ + public function getLastTimeTest() + { + $objects = $this->objectModel->getLastTime(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Runable cron test. + * + * @access public + * @return bool + */ + public function runableTest() + { + $objects = $this->objectModel->runable(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Check change cron test. + * + * @access public + * @return bool + */ + public function checkChangeTest() + { + $objects = $this->objectModel->checkChange(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Create cron test. + * + * @param array $param + * @access public + * @return int + */ + public function createTest($param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $cronID = $this->objectModel->create(); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Update cron test. + * + * @param int $cronID + * @access public + * @return bool + */ + public function updateTest($cronID, $param) + { + foreach($param as $k => $v) $_POST[$k] = $v; + $objects = $this->objectModel->update($cronID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getById($cronID); + return $objects; + } + + /** + * Check cron rule test. + * + * @param object $cron + * @access public + * @return string + */ + public function checkRuleTest($cron) + { + $objects = $this->objectModel->checkRule($cron); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Mark cron status test. + * + * @param mixed $status + * @param int $configID + * @access public + * @return void + */ + public function markCronStatusTest($status, $configID = 0) + { + $objects = $this->objectModel->markCronStatus($status, $configID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get config id test. + * + * @access public + * @return void + */ + public function getConfigIDTest() + { + $objects = $this->objectModel->getConfigID(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get current cron status test. + * + * @access public + * @return int + */ + public function getTurnonTest() + { + $objects = $this->objectModel->getTurnon(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/cron/changestatus.php b/test/model/cron/changestatus.php new file mode 100644 index 0000000000..0cc56a16f4 --- /dev/null +++ b/test/model/cron/changestatus.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$status = 'stop'; +$result = $cron->changeStatusTest($cronID,$status); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); //更新定时任务状态之后查看返回值 +r($cronInfo) && p('status') && e('stop'); //更新定时任务状态之后查看状态值 + +system('./ztest init'); diff --git a/test/model/cron/changestatusrunning.php b/test/model/cron/changestatusrunning.php new file mode 100644 index 0000000000..133ef80b9a --- /dev/null +++ b/test/model/cron/changestatusrunning.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatusRunning(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 4; +$lastTime = '0000-00-00 00:00:00'; +$result = $cron->changeStatusRunningTest($cronID, $lastTime); +$cronInfo = $tester->cron->getById($cronID); + +r($result) && p() && e('1'); // 更新之后查看返回值是否是1 +r($cronInfo) && p('status') && e('running'); // 更新之后查看状态值是否是running + +system('./ztest init'); diff --git a/test/model/cron/checkchange.php b/test/model/cron/checkchange.php new file mode 100644 index 0000000000..9307c2cf22 --- /dev/null +++ b/test/model/cron/checkchange.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +checkChange(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +r($cron->checkChangeTest()) && p() && e('1'); //判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 diff --git a/test/model/cron/checkrule.php b/test/model/cron/checkrule.php new file mode 100644 index 0000000000..f3b893afb0 --- /dev/null +++ b/test/model/cron/checkrule.php @@ -0,0 +1,46 @@ +#!/usr/bin/env php +checkRule(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55x'; +$res1 = $cron->checkRuleTest($cron1); + +$cron1->m = '55'; +$cron1->h = '23x'; +$res2 = $cron->checkRuleTest($cron1); + +$cron1->h = '23'; +$cron1->dom = '30x'; +$res3 = $cron->checkRuleTest($cron1); + +$cron1->dom = '30'; +$cron1->mon = '12x'; +$res4 = $cron->checkRuleTest($cron1); + +$cron1->mon = '12'; +$cron1->dow = '6x'; +$res5 = $cron->checkRuleTest($cron1); + +$cron1->dow = '6'; +$cron1->command = ''; +$res6 = $cron->checkRuleTest($cron1); + +r($res1) && p() && e('"分" 填写的不是合法的值'); // 定时任务'分'填写不正确情况 +r($res2) && p() && e('"小时" 填写的不是合法的值') // 定时任务'小时'填写不正确情况 +r($res3) && p() && e('"天" 填写的不是合法的值'); // 定时任务'天'填写不正确情况 +r($res4) && p() && e('"月" 填写的不是合法的值'); // 定时任务'月'填写不正确情况 +r($res5) && p() && e('"周" 填写的不是合法的值'); // 定时任务'周'填写不正确情况 +r($res6) && p() && e('『命令』不能为空。'); // 定时任务'命令'填写不正确情况 + diff --git a/test/model/cron/create.php b/test/model/cron/create.php new file mode 100644 index 0000000000..208b418dd9 --- /dev/null +++ b/test/model/cron/create.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->createTest($cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->createTest($cron1); + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//添加之后对比添加数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //添加之后对比添加数据信息 + +system('./ztest init'); diff --git a/test/model/cron/getbyid.php b/test/model/cron/getbyid.php new file mode 100644 index 0000000000..72643ba684 --- /dev/null +++ b/test/model/cron/getbyid.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getById(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronInfo1 = $cron->getByIdTest(2); +$cronInfo2 = $cron->getByIdTest(16); + +r($cronInfo1) && p('command,remark,m,h,status') && e('moduleName=execution&methodName=computeburn,更新燃尽图,30,23,normal'); //获取ID为2的定时的命令,备注,分,时 +r($cronInfo2) && p('command,remark,m,h,status') && e('moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop'); //获取ID为16的定时的命令,备注,分,时 diff --git a/test/model/cron/getconfigid.php b/test/model/cron/getconfigid.php new file mode 100644 index 0000000000..3f575037df --- /dev/null +++ b/test/model/cron/getconfigid.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getConfigID(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $cron->getConfigIDTest(); + +r($id) && p() && e('19'); //查询cron的configID,目前内置的是19 diff --git a/test/model/cron/getcrons.php b/test/model/cron/getcrons.php new file mode 100644 index 0000000000..f54edad96c --- /dev/null +++ b/test/model/cron/getcrons.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getCrons(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$list = $cron->getCronsTest(); +$noStopList = $cron->getCronsTest('nostop'); + +r(count($list)) && p() && e('19'); // 没有筛选条件时候,获取所有定时任务 +r(count($noStopList)) && p() && e('16'); // 有筛选条件时候,获取定时任务 +r($list) && p('12:remark,command') && e('同步Jenkins任务状态,moduleName=ci&methodName=checkCompileStatus'); // 获取某个定时任务的信息 diff --git a/test/model/cron/getlasttime.php b/test/model/cron/getlasttime.php new file mode 100644 index 0000000000..385076195a --- /dev/null +++ b/test/model/cron/getlasttime.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getLastTime(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$lastTime = $cron->getLastTimeTest(); + +r($lastTime) && p() && e('2022-04-01 13:42:45'); //获取最后执行时间进行对比 diff --git a/test/model/cron/getturnon.php b/test/model/cron/getturnon.php new file mode 100644 index 0000000000..305bb6502b --- /dev/null +++ b/test/model/cron/getturnon.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getTurnon(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$value = $cron->getTurnonTest(); + +r($value) && p() && e('1'); //查询定时任务配置是否开启 diff --git a/test/model/cron/logcron.php b/test/model/cron/logcron.php new file mode 100644 index 0000000000..0d51e9175e --- /dev/null +++ b/test/model/cron/logcron.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +logCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$file = $tester->app->getLogRoot() . 'cron.' . date('Ymd') . '.log.php'; +if(is_file($file)) unlink($file); + +$cron->logCronTest('cronlogtest'); +$info = file_get_contents($file); +$strExists = strpos($info,'cronlogtest'); + +r($strExists) && p() && e('14');// 调用日志方法查看日志文件该字符串位置 diff --git a/test/model/cron/markcronstatus.php b/test/model/cron/markcronstatus.php new file mode 100644 index 0000000000..050af6a8c9 --- /dev/null +++ b/test/model/cron/markcronstatus.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +markCronStatus(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$id = $tester->cron->getConfigID(); +$configID = $cron->markCronStatusTest('stop', $id); +$config1 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->delete()->from(TABLE_CONFIG)->where('id')->eq($configID)->exec(); +$configID = $cron->markCronStatusTest('run'); +$config2 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); + +$tester->dao->update(TABLE_CONFIG)->set('id')->eq($id)->where('id')->eq($configID)->exec(); + +r($config1) && p('value') && e('stop'); //修改配置项之后查看更新信息 +r($config2) && p('value') && e('run'); //修改配置项之后查看更新信息 + +system('./ztest init'); diff --git a/test/model/cron/parsecron.php b/test/model/cron/parsecron.php new file mode 100644 index 0000000000..bfcb7151ab --- /dev/null +++ b/test/model/cron/parsecron.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +parseCron(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$crons = $tester->cron->getCrons('nostop'); +$parse = $cron->parseCronTest($crons); + +r($parse) && p('19:schema,command') && e('*/5 * * * *,moduleName=measurement&methodName=execCrontabQueue');//获取id为19的定时任务的定时信息和命令信息 +r($parse) && p('15:schema,command') && e('30 23 * * *,moduleName=execution&methodName=computeTaskEffort'); //获取id为15的定时任务的定时信息和命令信息 + +system('./ztest init'); diff --git a/test/model/cron/runable.php b/test/model/cron/runable.php new file mode 100644 index 0000000000..8e39324edf --- /dev/null +++ b/test/model/cron/runable.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +runable(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); + +$tester->config->global->cron = 0; +$res1 = $cron->runableTest(); + +$tester->config->global->cron = 1; +$res2 = $cron->runableTest(); + +$tester->config->cron->maxRunTime = PHP_INT_MAX; +unset($tester->config->cron->run->status); +$res3 = $cron->runableTest(); + +$tester->config->cron->run->status = 'stop'; +$res4 = $cron->runableTest(); + +$tester->config->cron->run->status = 'running'; +$res5 = $cron->runableTest(); + +r($res1) && p() && e('0'); //cron配置为空情况 +r($res2) && p() && e('1'); //cron配置存在,执行时间大于最大可执行时间情况 +r($res3) && p() && e('1'); //cron状态为空情况 +r($res4) && p() && e('1'); //cron状态是stop情况 +r($res5) && p() && e('0'); //cron状态存在不是stop情况 diff --git a/test/model/cron/update.php b/test/model/cron/update.php new file mode 100644 index 0000000000..f89fdfda33 --- /dev/null +++ b/test/model/cron/update.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$cron = new cronTest(); +$cronID = 1; +$cron1 = new stdClass(); +$cron1->m = '55'; +$cron1->h = '23'; +$cron1->dom = '30'; +$cron1->mon = '12'; +$cron1->dow = '6'; +$cron1->remark = ''; +$cron1->type = 'zentao' ; +$cron1->command = ''; +$result1 = $cron->updateTest($cronID, $cron1); + +$cron1->command = 'test comand'; +$result2 = $cron->updateTest($cronID, $cron1); + + +r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 +r($result2) && p('command,type') && e('test comand,zentao');//更新之后对比更新数据信息 +r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //更新之后对比更新数据信息 + +system('./ztest init'); diff --git a/test/ztest b/test/ztest index e2b1377185..72dd63efe3 100755 --- a/test/ztest +++ b/test/ztest @@ -60,6 +60,11 @@ switch($argv[1]) break; case 'my': ztfRun('model/my'); + case 'caselib': + ztfRun('model/caselib'); + break; + case 'cron': + ztfRun('model/cron'); break; case 'model': ztfRun('model'); From e40adde8cb619256c69e2ddd8b9a545d71d94e3e Mon Sep 17 00:00:00 2001 From: yinjinzhu Date: Sat, 2 Apr 2022 17:42:47 +0800 Subject: [PATCH 07/39] auto test release model --- test/class/release.class.php | 352 +++++++++++++++++++++++ test/model/release/batchunlinkbug.php | 31 ++ test/model/release/batchunlinkstory.php | 26 ++ test/model/release/changestatus.php | 24 ++ test/model/release/create.php | 43 +++ test/model/release/getbyid.php | 26 ++ test/model/release/getlast.php | 25 ++ test/model/release/getlist.php | 65 +++++ test/model/release/getnotifypersons.php | 38 +++ test/model/release/getreleasedbuilds.php | 33 +++ test/model/release/gettoandcclist.php | 21 ++ test/model/release/linkbug.php | 30 ++ test/model/release/linkstory.php | 26 ++ test/model/release/sendmail.php | 19 ++ test/model/release/sendmail2feedback.php | 19 ++ test/model/release/unlinkbug.php | 29 ++ test/model/release/unlinkstory.php | 26 ++ test/model/release/update.php | 33 +++ 18 files changed, 866 insertions(+) create mode 100644 test/class/release.class.php create mode 100755 test/model/release/batchunlinkbug.php create mode 100755 test/model/release/batchunlinkstory.php create mode 100755 test/model/release/changestatus.php create mode 100755 test/model/release/create.php create mode 100755 test/model/release/getbyid.php create mode 100755 test/model/release/getlast.php create mode 100755 test/model/release/getlist.php create mode 100755 test/model/release/getnotifypersons.php create mode 100755 test/model/release/getreleasedbuilds.php create mode 100755 test/model/release/gettoandcclist.php create mode 100755 test/model/release/linkbug.php create mode 100755 test/model/release/linkstory.php create mode 100755 test/model/release/sendmail.php create mode 100755 test/model/release/sendmail2feedback.php create mode 100755 test/model/release/unlinkbug.php create mode 100755 test/model/release/unlinkstory.php create mode 100755 test/model/release/update.php diff --git a/test/class/release.class.php b/test/class/release.class.php new file mode 100644 index 0000000000..1efce48bdf --- /dev/null +++ b/test/class/release.class.php @@ -0,0 +1,352 @@ +objectModel = $tester->loadModel('release'); + } + + /** + * function getByIDTest by release + * + * @param string $releaseID + * @param beel $setImgSize + * @access public + * @return array + */ + public function getByIDTest($releaseID, $setImgSize = false) + { + $objects = $this->objectModel->getByID($releaseID, $setImgSize); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * function getListTest by release + * + * @param string $productID + * @param string $branch + * @param string $type + * @access public + * @return array + */ + + public function getListTest($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc', $pager = null) + { + $objects = $this->objectModel->getList($productID, $branch, $type, $orderBy, $pager); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * function getLastTest by release + * + * @param string $productID + * @param string $branch + * @access public + * @return array + */ + public function getLastTest($productID, $branch = 0) + { + $objects = $this->objectModel->getLast($productID, $branch); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get released test builds from product . + * + * @param int $productID + * @param string|int $branch + * @access public + * @return void + */ + public function getReleasedBuildsTest($productID, $branch = 'all') + { + $objects = $this->objectModel->getReleasedBuilds($productID, $branch); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Create a release. + * + * @param int $productID + * @param int $branch + * @param int $projectID + * @access public + * @return array + */ + + public function createTest($productID = 0, $branch = 0, $projectID = 0, $param = array()) + { + + $date = date('Y-m-d'); + $labels = array(); + $files = array(); + $mailto = array(); + + $createFields = array('name' => '','marker' => '1', 'build' => '', 'date' => $date, 'desc' => '', 'mailto' => $mailto , 'labels' => $labels, 'files' => $files); + + foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue; + foreach($param as $key => $value) $_POST[$key] = $value; + + $objectsID = $this->objectModel->create($productID, $branch, $projectID); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($objectsID); + + return $objects; + } + /** + * Update a release. + * + * @param int $releaseID + * @access public + * @return array + */ + + public function updateTest($releaseID, $param = array()) + { + $date = date('Y-m-d'); + $labels = array(); + $files = array(); + $mailto = array(); + + $createFields = array('name' => '','marker' => '1', 'build' => '', 'date' => $date, 'desc' => '', 'mailto' => $mailto , 'labels' => $labels, 'files' => $files); + + foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue; + foreach($param as $key => $value) $_POST[$key] = $value; + $this->objectModel->update($releaseID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Get notify persons. + * + * @param string $notfiyList + * @param int $productID + * @param int $buildID + * @param int $releaseID + * @access public + * @return array + */ + + public function getNotifyPersonsTest($notifyList = '', $productID = 0, $buildID = 0, $releaseID = 0) + { + $objects = $this->objectModel->getNotifyPersons($notifyList, $productID, $buildID, $releaseID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Link stories + * + * @param int $releaseID + * @access public + * @return array + */ + + public function linkStoryTest($releaseID, $stories) + { + $_POST['stories'] = $stories; + $this->objectModel->linkStory($releaseID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Unlink story + * + * @param int $releaseID + * @param int $storyID + * @access public + * @return array + */ + public function unlinkStoryTest($releaseID, $storyID) + { + $_POST['stories'] = $storyID; + $this->objectModel->linkStory($releaseID); + unset($_POST); + + $this->objectModel->unlinkStory($releaseID, $storyID[0]); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Batch unlink story. + * + * @param int $releaseID + * @access public + * @return array + */ + + public function batchUnlinkStoryTest($releaseID, $stories) + { + $_POST['stories'] = $stories; + $this->objectModel->linkStory($releaseID); + unset($_POST); + + $_POST['storyIdList'] = $stories; + $this->objectModel->batchUnlinkStory($releaseID); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + + return $objects; + } + + /** + * Link bugs. + * + * @param int $releaseID + * @param string $type + * @access public + * @return array + */ + + public function linkBugTest($releaseID, $type = 'bug', $bugs) + { + $_POST['bugs'] = $bugs; + $this->objectModel->linkBug($releaseID, $type); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Unlink bug. + * + * @param int $releaseID + * @param int $bugID + * @param string $type + * @access public + * @return void + */ + + public function unlinkBugTest($releaseID, $bugID, $type = 'bug') + { + $_POST['bugs'] = $bugID; + $this->objectModel->linkBug($releaseID); + unset($_POST); + + $this->objectModel->unlinkBug($releaseID, $bugID[0], $type); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Batch unlink bug. + * + * @param int $releaseID + * @param string $type + * @access public + * @return array + */ + public function batchUnlinkBugTest($releaseID, $type = 'bug', $bugs) + { + $_POST['bugs'] = $bugs; + $this->objectModel->linkBug($releaseID); + unset($_POST); + + $_POST['unlinkBugs'] = $bugs; + $this->objectModel->batchUnlinkBug($releaseID, $type); + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + /** + * Change status. + * + * @param int $releaseID + * @param string $status + * @access public + * @return bool + */ + + public function changeStatusTest($releaseID, $status) + { + $this->objectModel->changeStatus($releaseID, $status); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getByID($releaseID); + return $objects; + } + + public function sendmailTest($releaseID) + { + $objects = $this->objectModel->sendmail($releaseID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + + /** + * Get toList and ccList. + * + * @param object $release + * @access public + * @return bool|array + */ + public function getToAndCcListTest($releaseID) + { + $release = $this->objectModel->getByID($releaseID); + + $objects = $this->objectModel->getToAndCcList($release); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function sendMail2FeedbackTest($release, $subject) + { + $objects = $this->objectModel->sendMail2Feedback($release, $subject); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/release/batchunlinkbug.php b/test/model/release/batchunlinkbug.php new file mode 100755 index 0000000000..57c1242492 --- /dev/null +++ b/test/model/release/batchunlinkbug.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +batchUnlinkBug(); +cid=1 +pid=1 + +正常任务批量移除解决的Bug >> 1, +正常任务批量移除遗留的Bug >> 1, +停止维护任务批量移除解决的Bug >> 6, +停止维护任务批量移除遗留的Bug >> 6, + +*/ + +$releaseID = array('1','6'); +$bugs = array('314','315'); +$type = array('bug', 'leftBug'); + +$release = new releaseTest(); + +r($release->batchUnlinkBugTest($releaseID[0], $bugs ,$type[0])) && p('id,bugs,leftBugs') && e('1,'); //正常任务批量移除解决的Bug +r($release->batchUnlinkBugTest($releaseID[0], $bugs ,$type[1])) && p('id,bugs,leftBugs') && e('1,'); //正常任务批量移除遗留的Bug +r($release->batchUnlinkBugTest($releaseID[1], $bugs ,$type[0])) && p('id,bugs,leftBugs') && e('6,'); //停止维护任务批量移除解决的Bug +r($release->batchUnlinkBugTest($releaseID[1], $bugs ,$type[1])) && p('id,bugs,leftBugs') && e('6,'); //停止维护任务批量移除遗留的Bug + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/batchunlinkstory.php b/test/model/release/batchunlinkstory.php new file mode 100755 index 0000000000..54dd63243e --- /dev/null +++ b/test/model/release/batchunlinkstory.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +batchUnlinkStory(); +cid=1 +pid=1 + +正常任务批量移除关联需求 >> 1, +停止维护任务批量移除关联需求 >> 6, + +*/ + +$releaseID = array('1','6'); +$stories = array('2','4'); + +$release = new releaseTest(); + +r($release->batchUnlinkStoryTest($releaseID[0],$stories)) && p('id,stories') && e('1,'); //正常任务批量移除关联需求 +r($release->batchUnlinkStoryTest($releaseID[1],$stories)) && p('id,stories') && e('6,'); //停止维护任务批量移除关联需求 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/changestatus.php b/test/model/release/changestatus.php new file mode 100755 index 0000000000..cc38adba04 --- /dev/null +++ b/test/model/release/changestatus.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +changeStatus(); +cid=1 +pid=1 + +正常任务批量移除遗留的Bug >> 1,terminate +停止维护任务批量移除解决的Bug >> 6,normal + +*/ + +$releaseID = array('1','6'); +$status = array('normal','terminate'); + +$release = new releaseTest(); + +r($release->changeStatusTest($releaseID[0], $status[1])) && p('id,status') && e('1,terminate'); //正常任务批量移除遗留的Bug +r($release->changeStatusTest($releaseID[1], $status[0])) && p('id,status') && e('6,normal'); //停止维护任务批量移除解决的Bug \ No newline at end of file diff --git a/test/model/release/create.php b/test/model/release/create.php new file mode 100755 index 0000000000..2b92dc57b4 --- /dev/null +++ b/test/model/release/create.php @@ -0,0 +1,43 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +执行版本新增发布 >> 11,新增执行版本发布,13 +项目版本新增发布 >> 12,新增项目版本发布,3 +创建里程碑发布 >> 13,新增里程碑发布,13 +创建将版本中完成的研发需求和已解决的Bug关联的发布 >> 14,新增关联发布,13 +创建将版本中完成的研发需求和已解决的Bug不关联的发布 >> 15,新增不关联发布,13 +名称为空测试 >> 『发布名称』不能为空。 +名称重复测试 >> 『发布名称』已经有『新增执行版本发布』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 + +*/ + +$productID = 3; +$branch = 'all'; +$projectID = '0'; + +$release = new releaseTest(); + +$executionRelease = array('name' => '新增执行版本发布', 'marker' => '0', 'build' => '13', 'desc' => '', 'sync' => true); +$projectRelease = array('name' => '新增项目版本发布', 'marker' => '0', 'build' => '3', 'desc' => '', 'sync' => true); +$markerRelease = array('name' => '新增里程碑发布', 'marker' => '1', 'build' => '13', 'desc' => '', 'sync' => true); +$syncRelease = array('name' => '新增关联发布', 'marker' => '0', 'build' => '13', 'desc' => '', 'sync' => true); +$noSyncnormalRelease = array('name' => '新增不关联发布', 'marker' => '0', 'build' => '13', 'desc' => '', 'sync' => false); +$noNameRelease = array('name' => '', 'marker' => '0', 'build' => '13', 'desc' => '', 'sync' => true); + +r($release->createTest($projectID, $branch, $projectID, $executionRelease)) && p('id,name,build') && e('11,新增执行版本发布,13'); //执行版本新增发布 +r($release->createTest($projectID, $branch, $projectID, $projectRelease)) && p('id,name,build') && e('12,新增项目版本发布,3'); //项目版本新增发布 +r($release->createTest($projectID, $branch, $projectID, $markerRelease)) && p('id,name,build') && e('13,新增里程碑发布,13'); //创建里程碑发布 +r($release->createTest($projectID, $branch, $projectID, $syncRelease)) && p('id,name,build') && e('14,新增关联发布,13'); //创建将版本中完成的研发需求和已解决的Bug关联的发布 +r($release->createTest($projectID, $branch, $projectID, $noSyncnormalRelease)) && p('id,name,build') && e('15,新增不关联发布,13'); //创建将版本中完成的研发需求和已解决的Bug不关联的发布 +r($release->createTest($projectID, $branch, $projectID, $noNameRelease)) && p('name:0') && e('『发布名称』不能为空。'); //名称为空测试 +r($release->createTest($projectID, $branch, $projectID, $executionRelease)) && p('name:0') && e('『发布名称』已经有『新增执行版本发布』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); //名称重复测试 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/getbyid.php b/test/model/release/getbyid.php new file mode 100755 index 0000000000..67b5ba8414 --- /dev/null +++ b/test/model/release/getbyid.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getByID(); +cid=1 +pid=1 + +正常发布查询 >> 产品正常的正常的发布1,normal +停止维护查询 >> 项目停止维护的停止维护的里程碑发布6,terminate +无ID查询 >> 0 +图片字段传字符串测试 >> 产品正常的正常的发布1,normal + +*/ +$releaseID = array('1', '6'); + +$release = new releaseTest(); + +r($release->getByIDTest($releaseID[0],true)) && p('name,status') && e('产品正常的正常的发布1,normal'); //正常发布查询 +r($release->getByIDTest($releaseID[1],false)) && p('name,status') && e('项目停止维护的停止维护的里程碑发布6,terminate');//停止维护查询 +r($release->getByIDTest('',true)) && p('') && e('0'); //无ID查询 +r($release->getByIDTest($releaseID[0],'true')) && p('name,status') && e('产品正常的正常的发布1,normal'); //图片字段传字符串测试 \ No newline at end of file diff --git a/test/model/release/getlast.php b/test/model/release/getlast.php new file mode 100755 index 0000000000..d837de0b7f --- /dev/null +++ b/test/model/release/getlast.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +getLast(); +cid=1 +pid=1 + +产品ID正常查询 >> 1,产品正常的正常的发布1 +产品ID为空查询 >> 0 +产品ID不存在查询 >> 0 + +*/ + +$productID = array('1', '10000'); + +$release = new releaseTest(); + +r($release->getLastTest($productID[0])) && p('id,name') && e('1,产品正常的正常的发布1'); //产品ID正常查询 +r($release->getLastTest('')) && p('') && e('0'); //产品ID为空查询 +r($release->getLastTest($productID[1])) && p('') && e('0'); //产品ID不存在查询 \ No newline at end of file diff --git a/test/model/release/getlist.php b/test/model/release/getlist.php new file mode 100755 index 0000000000..530ee0a0b6 --- /dev/null +++ b/test/model/release/getlist.php @@ -0,0 +1,65 @@ +#!/usr/bin/env php +getList(); +cid=1 +pid=1 + +branch为'all'并且type为'all'时数据查询 >> 1,产品正常的正常的发布1 +branch为'all'并且type为'normal'时数据查询 >> 3,产品正常的正常的发布3 +branch为'all'并且type为'terminate'时数据查询 >> 6,项目停止维护的停止维护的里程碑发布6 +branch为'all'并且type为空时数据查询 >> 0 +branch为0并且type为'all'时数据查询 >> 1,产品正常的正常的发布1 +branch为0并且type为'normal'时数据查询 >> 1,产品正常的正常的发布1 +branch为0并且type为'terminate'时数据查询 >> 6,项目停止维护的停止维护的里程碑发布6 +branch为0并且type为空时数据查询 >> 0 +branch为1并且type为'all'时数据查询 >> 0 +branch为1并且type为'normal'时数据查询 >> 0 +branch为1并且type为'terminate'时数据查询 >> 0 +branch为1并且type为空时数据查询 >> 0 +branch为2并且type为'all'时数据查询 >> 0 +branch为2并且type为'normal'时数据查询 >> 0 +branch为2并且type为'terminate'时数据查询 >> 0 +branch为2并且type为空时数据查询 >> 0 +branch为空并且type为'all'时数据查询 >> 1,产品正常的正常的发布1 +branch为空并且type为'normal'时数据查询 >> 1,产品正常的正常的发布1 +branch为空并且type为'terminate'时数据查询 >> 6,项目停止维护的停止维护的里程碑发布6 +branch为空并且type为空时数据查询 >> 0 +产品ID为空数据查询 >> 1,产品正常的正常的发布1 +产品ID不存在数据查询 >> 0 + +*/ + +$productID = ['','1','10000']; +$branchArray = ['all','0','1','2','']; +$typeArray = ['all','normal','terminate','']; + +$release = new releaseTest(); + +r($release->getListTest($productID[1], $branchArray[0], $typeArray[0])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //branch为'all'并且type为'all'时数据查询 +r($release->getListTest($productID[1], $branchArray[0], $typeArray[1])) && p('1:id,name') && e('3,产品正常的正常的发布3'); //branch为'all'并且type为'normal'时数据查询 +r($release->getListTest($productID[1], $branchArray[0], $typeArray[2])) && p('0:id,name') && e('6,项目停止维护的停止维护的里程碑发布6'); //branch为'all'并且type为'terminate'时数据查询 +r($release->getListTest($productID[1], $branchArray[0], $typeArray[3])) && p() && e('0'); //branch为'all'并且type为空时数据查询 +r($release->getListTest($productID[1], $branchArray[1], $typeArray[0])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //branch为0并且type为'all'时数据查询 +r($release->getListTest($productID[1], $branchArray[1], $typeArray[1])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //branch为0并且type为'normal'时数据查询 +r($release->getListTest($productID[1], $branchArray[1], $typeArray[2])) && p('0:id,name') && e('6,项目停止维护的停止维护的里程碑发布6'); //branch为0并且type为'terminate'时数据查询 +r($release->getListTest($productID[1], $branchArray[1], $typeArray[3])) && p() && e('0'); //branch为0并且type为空时数据查询 +r($release->getListTest($productID[1], $branchArray[2], $typeArray[0])) && p() && e('0'); //branch为1并且type为'all'时数据查询 +r($release->getListTest($productID[1], $branchArray[2], $typeArray[1])) && p() && e('0'); //branch为1并且type为'normal'时数据查询 +r($release->getListTest($productID[1], $branchArray[2], $typeArray[2])) && p() && e('0'); //branch为1并且type为'terminate'时数据查询 +r($release->getListTest($productID[1], $branchArray[2], $typeArray[3])) && p() && e('0'); //branch为1并且type为空时数据查询 +r($release->getListTest($productID[1], $branchArray[3], $typeArray[0])) && p() && e('0'); //branch为2并且type为'all'时数据查询 +r($release->getListTest($productID[1], $branchArray[3], $typeArray[1])) && p() && e('0'); //branch为2并且type为'normal'时数据查询 +r($release->getListTest($productID[1], $branchArray[3], $typeArray[2])) && p() && e('0'); //branch为2并且type为'terminate'时数据查询 +r($release->getListTest($productID[1], $branchArray[3], $typeArray[3])) && p() && e('0'); //branch为2并且type为空时数据查询 +r($release->getListTest($productID[1], $branchArray[4], $typeArray[0])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //branch为空并且type为'all'时数据查询 +r($release->getListTest($productID[1], $branchArray[4], $typeArray[1])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //branch为空并且type为'normal'时数据查询 +r($release->getListTest($productID[1], $branchArray[4], $typeArray[2])) && p('0:id,name') && e('6,项目停止维护的停止维护的里程碑发布6'); //branch为空并且type为'terminate'时数据查询 +r($release->getListTest($productID[1], $branchArray[4], $typeArray[3])) && p() && e('0'); //branch为空并且type为空时数据查询 +r($release->getListTest($productID[0], $branchArray[0], $typeArray[0])) && p('0:id,name') && e('1,产品正常的正常的发布1'); //产品ID为空数据查询 +r($release->getListTest($productID[2], $branchArray[0], $typeArray[0])) && p() && e('0'); //产品ID不存在数据查询 \ No newline at end of file diff --git a/test/model/release/getnotifypersons.php b/test/model/release/getnotifypersons.php new file mode 100755 index 0000000000..5d5da0f8ee --- /dev/null +++ b/test/model/release/getnotifypersons.php @@ -0,0 +1,38 @@ +#!/usr/bin/env php +getNotifyPersons(); +cid=1 +pid=1 + +项目版本正常发布数据查询 >> po1 +项目版本停止维护数据查询 >> po1 +执行版本正常发布数据查询 >> po1 +执行版本停止发布数据查询 >> po1 +buildID为空查询 >> po1 +releaseID为空查询 >> po1 +buildID不存在查询 >> po1 +releaseID不存在查询 >> po1 + +*/ + +$notifyList = 'PO, QD, feedback, SC, ET, PT'; +$productID = 1; +$buildID = array('1','10','30',''); +$releaseID = array('1','6','20',''); + +$release = new releaseTest(); + +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[0], $releaseID[0])) && p('po1') && e('po1');//项目版本正常发布数据查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[0], $releaseID[1])) && p('po1') && e('po1');//项目版本停止维护数据查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[1], $releaseID[0])) && p('po1') && e('po1');//执行版本正常发布数据查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[1], $releaseID[1])) && p('po1') && e('po1');//执行版本停止发布数据查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[3], $releaseID[1])) && p('po1') && e('po1');//buildID为空查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[1], $releaseID[3])) && p('po1') && e('po1');//releaseID为空查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[2], $releaseID[0])) && p('po1') && e('po1');//buildID不存在查询 +r($release->getNotifyPersonsTest($notifyList, $productID, $buildID[0], $releaseID[2])) && p('po1') && e('po1');//releaseID不存在查询 \ No newline at end of file diff --git a/test/model/release/getreleasedbuilds.php b/test/model/release/getreleasedbuilds.php new file mode 100755 index 0000000000..d9b68b3cbf --- /dev/null +++ b/test/model/release/getreleasedbuilds.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +getReleasedBuilds(); +cid=1 +pid=1 + +branch为'all'时数据查询查询 >> 1,3 +branch为'0'时数据查询查询 >> 1,3 +branch为'1'时数据查询查询 >> 0 +branch为'2'时数据查询查询 >> 0 +branch为''时数据查询查询 >> 1,3 +产品ID为空查询 >> 0 +产品ID不存在查询 >> 0 + +*/ + +$productID = array('','1','10000'); +$brachArray = array('all','0','1','2',''); + +$release = new releaseTest(); +r($release->getReleasedBuildsTest($productID[1], $brachArray[0])) && p('0,1') && e('1,3'); //branch为'all'时数据查询查询 +r($release->getReleasedBuildsTest($productID[1], $brachArray[1])) && p('0,1') && e('1,3'); //branch为'0'时数据查询查询 +r($release->getReleasedBuildsTest($productID[1], $brachArray[2])) && p() && e('0'); //branch为'1'时数据查询查询 +r($release->getReleasedBuildsTest($productID[1], $brachArray[3])) && p() && e('0'); //branch为'2'时数据查询查询 +r($release->getReleasedBuildsTest($productID[1], $brachArray[4])) && p('0,1') && e('1,3'); //branch为''时数据查询查询 +r($release->getReleasedBuildsTest($productID[0], $brachArray[0])) && p() && e('0'); //产品ID为空查询 +r($release->getReleasedBuildsTest($productID[2], $brachArray[0])) && p() && e('0'); //产品ID不存在查询 \ No newline at end of file diff --git a/test/model/release/gettoandcclist.php b/test/model/release/gettoandcclist.php new file mode 100755 index 0000000000..25f992ea2a --- /dev/null +++ b/test/model/release/gettoandcclist.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getToAndCcList(); +cid=1 +pid=1 + +正常发布发信列表 >> admin; +停止维护发布发信列表 >> admin; + +*/ +$releaseID = array('1','6'); + +$release = new releaseTest(); +r($release->getToAndCcListTest($releaseID[0])) && p('0;1') && e('admin;'); //正常发布发信列表 +r($release->getToAndCcListTest($releaseID[1])) && p('0;1') && e('admin;'); //停止维护发布发信列表 \ No newline at end of file diff --git a/test/model/release/linkbug.php b/test/model/release/linkbug.php new file mode 100755 index 0000000000..17ac1dd2fa --- /dev/null +++ b/test/model/release/linkbug.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php +linkBug(); +cid=1 +pid=1 + +正常任务关联解决Bug >> 1,,311,312 +正常任务关联遗留Bug >> 1,,311,312,,311,312 +停止维护任务关联解决Bug >> 6,,311,312 +停止维护任务关联遗留Bug >> 6,,311,312,,311,312 + +*/ +$releaseID = array('1', '6'); +$bugs = array('311', '312'); +$type = array('bug', 'leftBug'); + +$release = new releaseTest(); + +r($release->linkBugTest($releaseID[0], $type[0], $bugs)) && p('id,bugs,leftBugs') && e('1,,311,312'); //正常任务关联解决Bug +r($release->linkBugTest($releaseID[0], $type[1], $bugs)) && p('id,bugs,leftBugs') && e('1,,311,312,,311,312'); //正常任务关联遗留Bug +r($release->linkBugTest($releaseID[1], $type[0], $bugs)) && p('id,bugs,leftBugs') && e('6,,311,312'); //停止维护任务关联解决Bug +r($release->linkBugTest($releaseID[1], $type[1], $bugs)) && p('id,bugs,leftBugs') && e('6,,311,312,,311,312'); //停止维护任务关联遗留Bug + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/linkstory.php b/test/model/release/linkstory.php new file mode 100755 index 0000000000..79d2faa72f --- /dev/null +++ b/test/model/release/linkstory.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +linkStory(); +cid=1 +pid=1 + +正常任务关联需求 >> 1,,2,4 +停止维护任务关联需求 >> 6,,2,4 + +*/ + +$releaseID = array('1','6'); +$stories = array('2','4'); + +$release = new releaseTest(); + +r($release->linkStoryTest($releaseID[0],$stories)) && p('id,stories') && e('1,,2,4'); //正常任务关联需求 +r($release->linkStoryTest($releaseID[1],$stories)) && p('id,stories') && e('6,,2,4'); //停止维护任务关联需求 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/sendmail.php b/test/model/release/sendmail.php new file mode 100755 index 0000000000..f69846e0f9 --- /dev/null +++ b/test/model/release/sendmail.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +sendmail(); +cid=1 +pid=1 + + + +*/ + +$release = new releaseTest(); + +r($release->sendmailTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/release/sendmail2feedback.php b/test/model/release/sendmail2feedback.php new file mode 100755 index 0000000000..f355b14729 --- /dev/null +++ b/test/model/release/sendmail2feedback.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +sendMail2Feedback(); +cid=1 +pid=1 + + + +*/ + +$release = new releaseTest(); + +r($release->sendMail2FeedbackTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/release/unlinkbug.php b/test/model/release/unlinkbug.php new file mode 100755 index 0000000000..b553f926ea --- /dev/null +++ b/test/model/release/unlinkbug.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +unlinkBug(); +cid=1 +pid=1 + +正常发布批量移除解决的Bug >> 1, +正常发布批量移除遗留的Bug >> 1, +停止维护发布批量移除解决的Bug >> 6, +停止维护发布批量移除遗留的Bug >> 6, + +*/ +$releaseID = array('1','6'); +$bugs = array('314'); +$type = array('bug', 'leftBug'); + +$release = new releaseTest(); + +r($release->unlinkBugTest($releaseID[0], $bugs ,$type[0])) && p('id,bugs,leftBugs') && e('1,'); //正常发布批量移除解决的Bug +r($release->unlinkBugTest($releaseID[0], $bugs ,$type[1])) && p('id,bugs,leftBugs') && e('1,'); //正常发布批量移除遗留的Bug +r($release->unlinkBugTest($releaseID[1], $bugs ,$type[0])) && p('id,bugs,leftBugs') && e('6,'); //停止维护发布批量移除解决的Bug +r($release->unlinkBugTest($releaseID[1], $bugs ,$type[1])) && p('id,bugs,leftBugs') && e('6,'); //停止维护发布批量移除遗留的Bug +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/unlinkstory.php b/test/model/release/unlinkstory.php new file mode 100755 index 0000000000..53037a4b19 --- /dev/null +++ b/test/model/release/unlinkstory.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +unlinkStory(); +cid=1 +pid=1 + +正常任务移除关联需求 >> 1, +停止维护任务移除关联需求 >> 6, + +*/ + +$releaseID = array('1','6'); +$stories = array('2'); + +$release = new releaseTest(); + +r($release->unlinkStoryTest($releaseID[0],$stories)) && p('id,stories') && e('1,'); //正常任务移除关联需求 +r($release->unlinkStoryTest($releaseID[1],$stories)) && p('id,stories') && e('6,'); //停止维护任务移除关联需求 + +system("./ztest init"); \ No newline at end of file diff --git a/test/model/release/update.php b/test/model/release/update.php new file mode 100755 index 0000000000..8b580d612a --- /dev/null +++ b/test/model/release/update.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +修改正常发布 >> 1,修改正常发布,1 +修改停止维护发布 >> 6,修改停止维护发布,11 +任务ID为空测试 >> 0 +名称为空测试 >> 『发布名称』不能为空。 + +*/ +$releaseID = array('1', '6', ''); + +$release = new releaseTest(); + +$normalRelease = array('name' => '修改正常发布', 'marker' => '0', 'build' => '1', 'status' => 'normal', 'product' => '1' ); +$terminateRelease = array('name' => '修改停止维护发布', 'marker' => '1', 'build' => '11', 'status' => 'terminate', 'product' => '1' ); +$noReleaseID = array('name' => '测试任务ID为空', 'marker' => '0', 'build' => '1', 'status' => 'normal', 'product' => '1' ); +$noName = array('name' => '', 'marker' => '0', 'build' => '1', 'status' => 'normal', 'product' => '1' ); + +r($release->updateTest($releaseID[0], $normalRelease)) && p('id,name,build') && e('1,修改正常发布,1'); //修改正常发布 +r($release->updateTest($releaseID[1], $terminateRelease)) && p('id,name,build') && e('6,修改停止维护发布,11'); //修改停止维护发布 +r($release->updateTest($releaseID[2], $noReleaseID)) && p() && e('0'); //任务ID为空测试 +r($release->updateTest($releaseID[0], $noName)) && p('name:0') && e('『发布名称』不能为空。'); //名称为空测试 + +system("./ztest init"); \ No newline at end of file From 23c6643896f27df5ad499563cafb5736202b6e95 Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Wed, 6 Apr 2022 08:44:02 +0800 Subject: [PATCH 08/39] add history data --- test/data/history.yaml | 47 +++++++++++++++++++++++++++++++++++++ test/data/zentao/config.php | 1 + 2 files changed, 48 insertions(+) create mode 100644 test/data/history.yaml diff --git a/test/data/history.yaml b/test/data/history.yaml new file mode 100644 index 0000000000..a6a92f07bf --- /dev/null +++ b/test/data/history.yaml @@ -0,0 +1,47 @@ +title: table zt_history +desc: "操作历史" +author: automated export +version: "1.0" +fields: + - field: id + note: "ID" + range: 1-100 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: action + note: "关联日志" + range: 1-100 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: field + note: "字段" + range: "resolution,resolvedBuild,resolvedDate,status" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: old + note: "旧值" + range: [1,2,2020-01-01,doing] + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: new + note: "新值" + range: [2,3,2020-01-17,done] + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: diff + note: "不同" + range: "" + prefix: "" + postfix: "" + loop: 0 + format: "" diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index f6927366b9..a7a1d4c747 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -11,6 +11,7 @@ $builder->usercontact = array('rows' => 61, 'extends' => array('usercontact')); $builder->userview = array('rows' => 400, 'extends' => array('userview')); $builder->dept = array('rows' => 100, 'extends' => array('dept')); $builder->action = array('rows' => 100, 'extends' => array('action')); +$builder->history = array('rows' => 100, 'extends' => array('history')); $builder->program = array('rows' => 10, 'extends' => array('project', 'program')); $builder->project = array('rows' => 90, 'extends' => array('project', 'project')); From 843c14c89406fd6dd859b03d1578504bc0be05b4 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 08:46:23 +0800 Subject: [PATCH 09/39] * Fix bug#6948. --- module/programplan/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/programplan/control.php b/module/programplan/control.php index 59391e5e23..2e57c04a49 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -125,7 +125,7 @@ class programplan extends control $this->programplan->create($projectID, $this->productID, $planID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - $locate = $this->createLink('project', 'execution', "status=all&projectID=$projectID"); + $locate = $this->createLink('project', 'execution', "status=all&projectID=$projectID&orderBy=order_asc&productID=$productID"); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); } From d05a9410796f56066772969494a77be1d1c9870c Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Wed, 6 Apr 2022 08:48:56 +0800 Subject: [PATCH 10/39] update action data --- test/data/action.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/data/action.yaml b/test/data/action.yaml index 6156236d7e..9265a3789f 100644 --- a/test/data/action.yaml +++ b/test/data/action.yaml @@ -33,8 +33,11 @@ fields: format: "" - field: actor note: "操作者" - from: common.user.v1.yaml - use: user + fields: + - field: actor1 + range: admin,dev,test + - field: actor2 + range: [],17-18 prefix: "" postfix: "" loop: 0 From 365a048084681306832147d96f71a142d01f115d Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Wed, 6 Apr 2022 09:38:07 +0800 Subject: [PATCH 11/39] * Change api for edit story. --- api/v1/entries/story.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index f154c54e8e..4273caf022 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -95,14 +95,12 @@ class storyEntry extends Entry $oldStory = $this->loadModel('story')->getByID($storyID); /* Set $_POST variables. */ - $fields = 'title,product,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords,uid,stage,notifyEmail'; + $fields = 'title,product,parent,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords,uid,stage,notifyEmail'; $this->batchSetPost($fields, $oldStory); - $this->setPost('parent', 0); $control = $this->loadController('story', 'edit'); $control->edit($storyID); - $data = $this->getData(); if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); From c4e9e00959d2542426d6c716794d979e1556d72b Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 09:49:30 +0800 Subject: [PATCH 12/39] * Fix bug#13881. --- module/task/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index 5316974064..130673592d 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -853,7 +853,7 @@ class taskModel extends model { $currentTask->status = 'done'; $currentTask->finishedBy = $this->app->user->account; - $currentTask->finishedDate = $now; + $currentTask->finishedDate = $task->finishedDate; } } @@ -1717,7 +1717,7 @@ class taskModel extends model ->setDefault('status', 'done') ->setDefault('finishedBy, lastEditedBy', $this->app->user->account) ->setDefault('finishedDate, lastEditedDate', $now) - ->removeIF(!empty($oldTask->team), 'finishedBy,finishedDate,status,left') + ->removeIF(!empty($oldTask->team), 'finishedBy,status,left') ->remove('comment,files,labels,currentConsumed') ->get(); From 4590b8956722139b2af38cb178395911321fdbbf Mon Sep 17 00:00:00 2001 From: zhangxuwen Date: Wed, 6 Apr 2022 10:22:24 +0800 Subject: [PATCH 13/39] Modify cron and caselib testcase --- test/model/caselib/batchcreatecase.php | 10 +++++++--- test/model/caselib/buildsearchform.php | 5 ++++- test/model/caselib/create.php | 7 ++++++- test/model/caselib/createfromimport.php | 10 +++++++--- test/model/caselib/delete.php | 4 +++- test/model/caselib/getbyid.php | 6 +++++- test/model/caselib/getlibcases.php | 6 +++++- test/model/caselib/getliblink.php | 7 ++++++- test/model/caselib/getlibraries.php | 4 +++- test/model/caselib/getlist.php | 5 ++++- test/model/caselib/savelibstate.php | 2 ++ test/model/caselib/setlibmenu.php | 11 +++++++---- test/model/caselib/update.php | 6 +++++- test/model/cron/changestatus.php | 7 +++++-- test/model/cron/changestatusrunning.php | 5 ++++- test/model/cron/checkchange.php | 4 +++- test/model/cron/checkrule.php | 20 +++++++++++++------- test/model/cron/create.php | 6 +++++- test/model/cron/getbyid.php | 5 ++++- test/model/cron/getconfigid.php | 4 +++- test/model/cron/getcrons.php | 10 +++++++--- test/model/cron/getlasttime.php | 4 +++- test/model/cron/getturnon.php | 4 +++- test/model/cron/logcron.php | 6 ++++-- test/model/cron/markcronstatus.php | 11 +++++++---- test/model/cron/parsecron.php | 9 ++++++--- test/model/cron/runable.php | 8 +++++++- test/model/cron/update.php | 7 +++++-- test/ztest | 1 + 29 files changed, 144 insertions(+), 50 deletions(-) mode change 100644 => 100755 test/model/cron/changestatus.php mode change 100644 => 100755 test/model/cron/changestatusrunning.php mode change 100644 => 100755 test/model/cron/checkchange.php mode change 100644 => 100755 test/model/cron/checkrule.php mode change 100644 => 100755 test/model/cron/create.php mode change 100644 => 100755 test/model/cron/getbyid.php mode change 100644 => 100755 test/model/cron/getconfigid.php mode change 100644 => 100755 test/model/cron/getcrons.php mode change 100644 => 100755 test/model/cron/getlasttime.php mode change 100644 => 100755 test/model/cron/getturnon.php mode change 100644 => 100755 test/model/cron/logcron.php mode change 100644 => 100755 test/model/cron/markcronstatus.php mode change 100644 => 100755 test/model/cron/parsecron.php mode change 100644 => 100755 test/model/cron/runable.php mode change 100644 => 100755 test/model/cron/update.php diff --git a/test/model/caselib/batchcreatecase.php b/test/model/caselib/batchcreatecase.php index 7e864c3f11..70fd2f2226 100755 --- a/test/model/caselib/batchcreatecase.php +++ b/test/model/caselib/batchcreatecase.php @@ -10,6 +10,10 @@ title=测试 caselibModel->batchCreateCase(); cid=1 pid=1 +添加两条数据之后查询数据条数是否正确 >> 12 +添加数据之后查询新加用例的名称,用例类型 >> 测试导入添加1,performance +添加数据之后查询新加用例的名称,用例类型 >> 测试导入添加2,unit + */ $caselib = new caselibTest(); @@ -25,11 +29,11 @@ $_POST = array( ); $caselib->batchCreateCaseTest(201); unset($_POST); -$total = $tester->dao->select('count(*) total')->from(TABLE_CASE)->where('lib')->eq(201)->fetch('total'); -$cases = $tester->dao->select('*')->from(TABLE_CASE)->where('lib')->eq(201)->fetchAll('id'); +$total = $tester->dao->select('count(*) total')->from(TABLE_CASE)->where( 'lib')->eq(201)->fetch('total'); +$cases = $tester->dao->select('*')->from(TABLE_CASE)->where( 'lib')->eq(201)->fetchAll('id'); r($total) && p() && e('12'); // 添加两条数据之后查询数据条数是否正确 r($cases) && p('411:title,type') && e('测试导入添加1,performance'); // 添加数据之后查询新加用例的名称,用例类型 r($cases) && p('412:title,type') && e('测试导入添加2,unit'); // 添加数据之后查询新加用例的名称,用例类型 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/caselib/buildsearchform.php b/test/model/caselib/buildsearchform.php index 1008baf312..24c06fb5a9 100755 --- a/test/model/caselib/buildsearchform.php +++ b/test/model/caselib/buildsearchform.php @@ -10,6 +10,9 @@ title=测试 caselibModel->buildSearchForm(); cid=1 pid=1 +测试设置的url参数 >> model/caselib/buildsearchform.php?m=caselib&f=browse&t=&libID=201&browseType=bySearch&queryID=myQueryID +测试设置的queryID值是否正确 >> 10 + */ $caselib = new caselibTest(); @@ -22,4 +25,4 @@ $caselib->buildSearchFormTest($libID, $libs, $queryID, $actionURL); $search = $tester->config->testcase->search; r($search) && p('actionURL') && e('model/caselib/buildsearchform.php?m=caselib&f=browse&t=&libID=201&browseType=bySearch&queryID=myQueryID'); //测试设置的url参数 -r($search) && p('queryID') && e('10'); //测试设置的queryID值是否正确 +r($search) && p('queryID') && e('10'); //测试设置的queryID值是否正确 \ No newline at end of file diff --git a/test/model/caselib/create.php b/test/model/caselib/create.php index 282060adc3..3a7d717eef 100755 --- a/test/model/caselib/create.php +++ b/test/model/caselib/create.php @@ -10,6 +10,11 @@ title=测试 caselibModel->create(); cid=1 pid=1 +测试名称是空时候添加 >> 『名称』不能为空。 +测试添加的名称信息 >> 测试用例库名称 +测试添加的描述信息 >> 测试用例库描述 +测试名称是空时候添加 >> 『名称』已经有『测试用例库名称』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 + */ $caselib = new caselibTest(); @@ -32,4 +37,4 @@ r($result2) && p('name') && e('测试用例库名称'); //测试添加的 r($result2) && p('desc') && e('测试用例库描述'); //测试添加的描述信息 r($result3) && p('name:0') && e('『名称』已经有『测试用例库名称』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); //测试名称是空时候添加 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/caselib/createfromimport.php b/test/model/caselib/createfromimport.php index 0503cfb7cd..dc3460156c 100755 --- a/test/model/caselib/createfromimport.php +++ b/test/model/caselib/createfromimport.php @@ -10,6 +10,10 @@ title=测试 caselibModel->createFromImport(); cid=1 pid=1 +添加两条数据之后查询数据条数是否正确 >> 12 +添加数据之后查询新加用例的名称,关键字 >> 测试导入添加1,keywords1 +添加数据之后查询新加用例的名称,关键字 >> 测试导入添加2,keywords2 + */ $caselib = new caselibTest(); @@ -28,11 +32,11 @@ $_POST = array( $caselib->createFromImportTest(201); unset($_POST); -$total = $tester->dao->select('count(*) total')->from(TABLE_CASE)->where('lib')->eq(201)->fetch('total'); -$cases = $tester->dao->select('*')->from(TABLE_CASE)->where('lib')->eq(201)->fetchAll('id'); +$total = $tester->dao->select('count(*) total')->from(TABLE_CASE)->where( 'lib')->eq(201)->fetch('total'); +$cases = $tester->dao->select('*')->from(TABLE_CASE)->where( 'lib')->eq(201)->fetchAll('id'); r($total) && p() && e('12'); //添加两条数据之后查询数据条数是否正确 r($cases) && p('411:title,keywords') && e('测试导入添加1,keywords1'); //添加数据之后查询新加用例的名称,关键字 r($cases) && p('412:title,keywords') && e('测试导入添加2,keywords2'); //添加数据之后查询新加用例的名称,关键字 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/caselib/delete.php b/test/model/caselib/delete.php index 18b6e67a32..c847a8fa88 100755 --- a/test/model/caselib/delete.php +++ b/test/model/caselib/delete.php @@ -10,6 +10,8 @@ title=测试 caselibModel->delete(); cid=1 pid=1 +测试删除之后deleted值是否为1 >> 1 + */ $caselib = new caselibTest(); @@ -17,4 +19,4 @@ $lib = $caselib->deleteTest(201); r($lib) && p('deleted') && e('1'); //测试删除之后deleted值是否为1 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/caselib/getbyid.php b/test/model/caselib/getbyid.php index c1b0baef36..cab078cf14 100755 --- a/test/model/caselib/getbyid.php +++ b/test/model/caselib/getbyid.php @@ -10,6 +10,10 @@ title=测试 caselibModel->getById(); cid=1 pid=1 +测试获取数据的名称信息 >> 这是测试套件名称201 +测试获取数据的描述信息 >> 这是测试套件的描述201 +测试获取数据的type类型 >> library + */ $caselib = new caselibTest(); @@ -17,4 +21,4 @@ $data = $caselib->getByIdTest(201); r($data) && p('name') && e('这是测试套件名称201'); //测试获取数据的名称信息 r($data) && p('desc') && e('这是测试套件的描述201'); //测试获取数据的描述信息 -r($data) && p('type') && e('library'); //测试获取数据的type类型 +r($data) && p('type') && e('library'); //测试获取数据的type类型 \ No newline at end of file diff --git a/test/model/caselib/getlibcases.php b/test/model/caselib/getlibcases.php index a2c2bf7474..d03a268b8d 100755 --- a/test/model/caselib/getlibcases.php +++ b/test/model/caselib/getlibcases.php @@ -10,6 +10,10 @@ title=测试 caselibModel->getLibCases(); cid=1 pid=1 +所有状态下,用例库下用例数量 >> 10 +搜索状态下,用例库下用例数量 >> 10 +分页状态下,用例库下用例数量 >> 5 + */ global $tester; $tester->app->loadClass('pager', $static = true); @@ -23,4 +27,4 @@ $list3 = $caselib->getLibCasesTest(201, 'all', '0', '0', 'id_desc', $pager); r(count($list1)) && p() && e('10'); //所有状态下,用例库下用例数量 r(count($list2)) && p() && e('10'); //搜索状态下,用例库下用例数量 -r(count($list3)) && p() && e('5'); //分页状态下,用例库下用例数量 +r(count($list3)) && p() && e('5'); //分页状态下,用例库下用例数量 \ No newline at end of file diff --git a/test/model/caselib/getliblink.php b/test/model/caselib/getliblink.php index 02d8d9dba4..d807e33254 100755 --- a/test/model/caselib/getliblink.php +++ b/test/model/caselib/getliblink.php @@ -10,6 +10,11 @@ title=测试 caselibModel->getLibLink(); cid=1 pid=1 +测试参数情况1返回值 >> model/caselib/getliblink.php?m=caselib&f=browse&t=&libID=%s +测试参数情况2返回值 >> model/caselib/getliblink.php?m=caselib&f=test&t=&libID=%s +测试参数情况3返回值 >> model/caselib/getliblink.php?m=tree&f=&t=&libID=%s&type=caselib¤tModuleID=0 +测试参数情况4返回值 >> model/caselib/getliblink.php?m=caselib&f=browse&t=&libID=%s + */ $caselib = new caselibTest(); @@ -21,4 +26,4 @@ $link4 = $caselib->getLibLinkTest('', '', ''); r($link1) && p() && e('model/caselib/getliblink.php?m=caselib&f=browse&t=&libID=%s'); // 测试参数情况1返回值 r($link2) && p() && e('model/caselib/getliblink.php?m=caselib&f=test&t=&libID=%s'); // 测试参数情况2返回值 r($link3) && p() && e('model/caselib/getliblink.php?m=tree&f=&t=&libID=%s&type=caselib¤tModuleID=0'); // 测试参数情况3返回值 -r($link4) && p() && e('model/caselib/getliblink.php?m=caselib&f=browse&t=&libID=%s'); // 测试参数情况4返回值 +r($link4) && p() && e('model/caselib/getliblink.php?m=caselib&f=browse&t=&libID=%s'); // 测试参数情况4返回值 \ No newline at end of file diff --git a/test/model/caselib/getlibraries.php b/test/model/caselib/getlibraries.php index d36719bf77..ebf573b964 100755 --- a/test/model/caselib/getlibraries.php +++ b/test/model/caselib/getlibraries.php @@ -10,9 +10,11 @@ title=测试 caselibModel->getLibraries(); cid=1 pid=1 +测试获取用例库的键值对 >> 这是测试套件名称201 + */ $caselib = new caselibTest(); $list = $caselib->getLibrariesTest(); -r($list) && p('201') && e('这是测试套件名称201'); //测试获取用例库的键值对 +r($list) && p('201') && e('这是测试套件名称201'); //测试获取用例库的键值对 \ No newline at end of file diff --git a/test/model/caselib/getlist.php b/test/model/caselib/getlist.php index a574b7e285..d742e33484 100755 --- a/test/model/caselib/getlist.php +++ b/test/model/caselib/getlist.php @@ -10,10 +10,13 @@ title=测试 caselibModel->getList(); cid=1 pid=1 +测试获取列表的个数,目前只有一个 >> 1 +测试获取列表某个用例库的名称信息 >> 这是测试套件名称201 + */ $caselib = new caselibTest(); $list = $caselib->getListTest(); r(count($list)) && p() && e('1'); //测试获取列表的个数,目前只有一个 -r($list) && p('201:name') && e('这是测试套件名称201');//测试获取列表某个用例库的名称信息 +r($list) && p('201:name') && e('这是测试套件名称201');//测试获取列表某个用例库的名称信息 \ No newline at end of file diff --git a/test/model/caselib/savelibstate.php b/test/model/caselib/savelibstate.php index fd95b8d816..3555267ba5 100755 --- a/test/model/caselib/savelibstate.php +++ b/test/model/caselib/savelibstate.php @@ -10,6 +10,8 @@ title=测试 caselibModel->saveLibState(); cid=1 pid=1 +保存用例库状态之后返回值 >> 201 + */ $caselib = new caselibTest(); diff --git a/test/model/caselib/setlibmenu.php b/test/model/caselib/setlibmenu.php index 5d7016e1d1..f209bb65d8 100755 --- a/test/model/caselib/setlibmenu.php +++ b/test/model/caselib/setlibmenu.php @@ -10,13 +10,16 @@ title=测试 caselibModel->setLibMenu(); cid=1 pid=1 +修改下拉菜单之后返回值 >> 1 + */ -$caselib = new caselibTest(); -$libs = $tester->loadModel('caselib')->getLibraries(); -$info = $caselib->setLibMenuTest($libs, 201); +$caselib = new caselibTest(); +$libs = $tester->loadModel('caselib')->getLibraries(); +$config->webRoot = 'model/caselib/';//ztest运行时候获取的不一致 +$info = $caselib->setLibMenuTest($libs, 201); $menuStr = << EOT; -r($tester->lang->switcherMenu) && p() && e($menuStr); //修改下拉菜单之后返回值 +r($tester->lang->switcherMenu == trim($menuStr)) && p() && e('1'); //修改下拉菜单之后返回值 diff --git a/test/model/caselib/update.php b/test/model/caselib/update.php index 985a7078f7..eb904f76b0 100755 --- a/test/model/caselib/update.php +++ b/test/model/caselib/update.php @@ -10,6 +10,10 @@ title=测试 caselibModel->update(); cid=1 pid=1 +测试更新名称为空时候返回 >> 『name』不能为空。 +测试更新之后名称信息 >> 测试修改名称 +测试更新之后描述信息 >> 测试修改描述 + */ $caselib = new caselibTest(); @@ -26,4 +30,4 @@ r($lib1) && p('name:0') && e('『name』不能为空。'); //测试更新名称 r($lib2) && p('name') && e('测试修改名称'); //测试更新之后名称信息 r($lib2) && p('desc') && e('测试修改描述'); //测试更新之后描述信息 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/cron/changestatus.php b/test/model/cron/changestatus.php old mode 100644 new mode 100755 index 0cc56a16f4..041fdf4539 --- a/test/model/cron/changestatus.php +++ b/test/model/cron/changestatus.php @@ -10,15 +10,18 @@ title=测试 cronModel->changeStatus(); cid=1 pid=1 +更新定时任务状态之后查看返回值 >> 1 +更新定时任务状态之后查看状态值 >> stop + */ $cron = new cronTest(); $cronID = 1; $status = 'stop'; -$result = $cron->changeStatusTest($cronID,$status); +$result = $cron->changeStatusTest($cronID, $status); $cronInfo = $tester->cron->getById($cronID); r($result) && p() && e('1'); //更新定时任务状态之后查看返回值 r($cronInfo) && p('status') && e('stop'); //更新定时任务状态之后查看状态值 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/cron/changestatusrunning.php b/test/model/cron/changestatusrunning.php old mode 100644 new mode 100755 index 133ef80b9a..ff13f28fea --- a/test/model/cron/changestatusrunning.php +++ b/test/model/cron/changestatusrunning.php @@ -10,6 +10,9 @@ title=测试 cronModel->changeStatusRunning(); cid=1 pid=1 +更新之后查看返回值是否是1 >> 1 +更新之后查看状态值是否是running >> running + */ $cron = new cronTest(); @@ -21,4 +24,4 @@ $cronInfo = $tester->cron->getById($cronID); r($result) && p() && e('1'); // 更新之后查看返回值是否是1 r($cronInfo) && p('status') && e('running'); // 更新之后查看状态值是否是running -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/cron/checkchange.php b/test/model/cron/checkchange.php old mode 100644 new mode 100755 index 9307c2cf22..9f2c8dc330 --- a/test/model/cron/checkchange.php +++ b/test/model/cron/checkchange.php @@ -10,8 +10,10 @@ title=测试 cronModel->checkChange(); cid=1 pid=1 +判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 >> 1 + */ $cron = new cronTest(); -r($cron->checkChangeTest()) && p() && e('1'); //判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 +r($cron->checkChangeTest()) && p() && e('1'); //判断是否存在时间是0000-00-00 00:00:00状态不是stop的定时任务存在 \ No newline at end of file diff --git a/test/model/cron/checkrule.php b/test/model/cron/checkrule.php old mode 100644 new mode 100755 index f3b893afb0..45d0043d36 --- a/test/model/cron/checkrule.php +++ b/test/model/cron/checkrule.php @@ -10,6 +10,13 @@ title=测试 cronModel->checkRule(); cid=1 pid=1 +定时任务'分'填写不正确情况 >> "分" 填写的不是合法的值 +定时任务'小时'填写不正确情况 >> "小时" 填写的不是合法的值 +定时任务'天'填写不正确情况 >> "天" 填写的不是合法的值 +定时任务'月'填写不正确情况 >> "月" 填写的不是合法的值 +定时任务'周'填写不正确情况 >> "周" 填写的不是合法的值 +定时任务'命令'填写不正确情况 >> 『命令』不能为空。 + */ $cron = new cronTest(); @@ -37,10 +44,9 @@ $cron1->dow = '6'; $cron1->command = ''; $res6 = $cron->checkRuleTest($cron1); -r($res1) && p() && e('"分" 填写的不是合法的值'); // 定时任务'分'填写不正确情况 -r($res2) && p() && e('"小时" 填写的不是合法的值') // 定时任务'小时'填写不正确情况 -r($res3) && p() && e('"天" 填写的不是合法的值'); // 定时任务'天'填写不正确情况 -r($res4) && p() && e('"月" 填写的不是合法的值'); // 定时任务'月'填写不正确情况 -r($res5) && p() && e('"周" 填写的不是合法的值'); // 定时任务'周'填写不正确情况 -r($res6) && p() && e('『命令』不能为空。'); // 定时任务'命令'填写不正确情况 - +r($res1) && p() && e('"分" 填写的不是合法的值'); // 定时任务'分'填写不正确情况 +r($res2) && p() && e('"小时" 填写的不是合法的值'); // 定时任务'小时'填写不正确情况 +r($res3) && p() && e('"天" 填写的不是合法的值'); // 定时任务'天'填写不正确情况 +r($res4) && p() && e('"月" 填写的不是合法的值'); // 定时任务'月'填写不正确情况 +r($res5) && p() && e('"周" 填写的不是合法的值'); // 定时任务'周'填写不正确情况 +r($res6) && p() && e('『命令』不能为空。'); // 定时任务'命令'填写不正确情况 diff --git a/test/model/cron/create.php b/test/model/cron/create.php old mode 100644 new mode 100755 index 208b418dd9..19fe20253c --- a/test/model/cron/create.php +++ b/test/model/cron/create.php @@ -10,6 +10,10 @@ title=测试 cronModel->create(); cid=1 pid=1 +命令为空时候返回值 >> 『命令』不能为空 +添加之后对比添加数据信息 >> test comand,zentao +添加之后对比添加数据信息 >> 55,23,30,12,6 + */ $cron = new cronTest(); @@ -31,4 +35,4 @@ r($result1[0]) && p() && e('『命令』不能为空'); //命 r($result2) && p('command,type') && e('test comand,zentao');//添加之后对比添加数据信息 r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //添加之后对比添加数据信息 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/cron/getbyid.php b/test/model/cron/getbyid.php old mode 100644 new mode 100755 index 72643ba684..de89ffe66b --- a/test/model/cron/getbyid.php +++ b/test/model/cron/getbyid.php @@ -10,6 +10,9 @@ title=测试 cronModel->getById(); cid=1 pid=1 +获取ID为2的定时的命令,备注,分,时 >> moduleName=execution&methodName=computeburn,更新燃尽图,30,23,normal +获取ID为16的定时的命令,备注,分,时 >> moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop + */ $cron = new cronTest(); @@ -17,4 +20,4 @@ $cronInfo1 = $cron->getByIdTest(2); $cronInfo2 = $cron->getByIdTest(16); r($cronInfo1) && p('command,remark,m,h,status') && e('moduleName=execution&methodName=computeburn,更新燃尽图,30,23,normal'); //获取ID为2的定时的命令,备注,分,时 -r($cronInfo2) && p('command,remark,m,h,status') && e('moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop'); //获取ID为16的定时的命令,备注,分,时 +r($cronInfo2) && p('command,remark,m,h,status') && e('moduleName=effort&methodName=remindNotRecord,提醒录入日志,30,7,stop'); //获取ID为16的定时的命令,备注,分,时 \ No newline at end of file diff --git a/test/model/cron/getconfigid.php b/test/model/cron/getconfigid.php old mode 100644 new mode 100755 index 3f575037df..da20cdb2d8 --- a/test/model/cron/getconfigid.php +++ b/test/model/cron/getconfigid.php @@ -10,9 +10,11 @@ title=测试 cronModel->getConfigID(); cid=1 pid=1 +查询cron的configID,目前内置的是19 >> 19 + */ $cron = new cronTest(); $id = $cron->getConfigIDTest(); -r($id) && p() && e('19'); //查询cron的configID,目前内置的是19 +r($id) && p() && e('19'); //查询cron的configID,目前内置的是19 \ No newline at end of file diff --git a/test/model/cron/getcrons.php b/test/model/cron/getcrons.php old mode 100644 new mode 100755 index f54edad96c..304b9d4689 --- a/test/model/cron/getcrons.php +++ b/test/model/cron/getcrons.php @@ -10,12 +10,16 @@ title=测试 cronModel->getCrons(); cid=1 pid=1 +没有筛选条件时候,获取所有定时任务 >> 19 +有筛选条件时候,获取定时任务 >> 16 +获取某个定时任务的信息 >> 同步DevOps构建任务状态,moduleName=ci&methodName=checkCompileStatus + */ $cron = new cronTest(); $list = $cron->getCronsTest(); $noStopList = $cron->getCronsTest('nostop'); -r(count($list)) && p() && e('19'); // 没有筛选条件时候,获取所有定时任务 -r(count($noStopList)) && p() && e('16'); // 有筛选条件时候,获取定时任务 -r($list) && p('12:remark,command') && e('同步Jenkins任务状态,moduleName=ci&methodName=checkCompileStatus'); // 获取某个定时任务的信息 +r(count($list)) && p() && e('19'); // 没有筛选条件时候,获取所有定时任务 +r(count($noStopList)) && p() && e('16'); // 有筛选条件时候,获取定时任务 +r($list) && p('12:remark,command') && e('同步DevOps构建任务状态,moduleName=ci&methodName=checkCompileStatus'); // 获取某个定时任务的信息 \ No newline at end of file diff --git a/test/model/cron/getlasttime.php b/test/model/cron/getlasttime.php old mode 100644 new mode 100755 index 385076195a..5fef30baf6 --- a/test/model/cron/getlasttime.php +++ b/test/model/cron/getlasttime.php @@ -10,9 +10,11 @@ title=测试 cronModel->getLastTime(); cid=1 pid=1 +获取最后执行时间进行对比 >> 19 + */ $cron = new cronTest(); $lastTime = $cron->getLastTimeTest(); -r($lastTime) && p() && e('2022-04-01 13:42:45'); //获取最后执行时间进行对比 +r(strlen($lastTime)) && p() && e('19'); //获取最后执行时间进行对比 \ No newline at end of file diff --git a/test/model/cron/getturnon.php b/test/model/cron/getturnon.php old mode 100644 new mode 100755 index 305bb6502b..64ef3b0398 --- a/test/model/cron/getturnon.php +++ b/test/model/cron/getturnon.php @@ -10,9 +10,11 @@ title=测试 cronModel->getTurnon(); cid=1 pid=1 +查询定时任务配置是否开启 >> 1 + */ $cron = new cronTest(); $value = $cron->getTurnonTest(); -r($value) && p() && e('1'); //查询定时任务配置是否开启 +r($value) && p() && e('1'); //查询定时任务配置是否开启 \ No newline at end of file diff --git a/test/model/cron/logcron.php b/test/model/cron/logcron.php old mode 100644 new mode 100755 index 0d51e9175e..da7dcf5d1b --- a/test/model/cron/logcron.php +++ b/test/model/cron/logcron.php @@ -10,14 +10,16 @@ title=测试 cronModel->logCron(); cid=1 pid=1 +调用日志方法查看日志文件该字符串位置 >> 14 + */ $cron = new cronTest(); -$file = $tester->app->getLogRoot() . 'cron.' . date('Ymd') . '.log.php'; +$file = $tester->app->getLogRoot() . 'cron.' . date( 'Ymd') . '.log.php'; if(is_file($file)) unlink($file); $cron->logCronTest('cronlogtest'); $info = file_get_contents($file); $strExists = strpos($info,'cronlogtest'); -r($strExists) && p() && e('14');// 调用日志方法查看日志文件该字符串位置 +r($strExists) && p() && e('14');// 调用日志方法查看日志文件该字符串位置 \ No newline at end of file diff --git a/test/model/cron/markcronstatus.php b/test/model/cron/markcronstatus.php old mode 100644 new mode 100755 index 050af6a8c9..d8b4eb0a78 --- a/test/model/cron/markcronstatus.php +++ b/test/model/cron/markcronstatus.php @@ -10,18 +10,21 @@ title=测试 cronModel->markCronStatus(); cid=1 pid=1 +修改配置项之后查看更新信息 >> stop +修改配置项之后查看更新信息 >> run + */ $cron = new cronTest(); $id = $tester->cron->getConfigID(); $configID = $cron->markCronStatusTest('stop', $id); -$config1 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); +$config1 = $tester->dao->select('*')->from(TABLE_CONFIG)->where( 'id')->eq($configID)->fetch(); -$tester->dao->delete()->from(TABLE_CONFIG)->where('id')->eq($configID)->exec(); +$tester->dao->delete()->from(TABLE_CONFIG)->where( 'id')->eq($configID)->exec(); $configID = $cron->markCronStatusTest('run'); -$config2 = $tester->dao->select('*')->from(TABLE_CONFIG)->where('id')->eq($configID)->fetch(); +$config2 = $tester->dao->select('*')->from(TABLE_CONFIG)->where( 'id')->eq($configID)->fetch(); -$tester->dao->update(TABLE_CONFIG)->set('id')->eq($id)->where('id')->eq($configID)->exec(); +$tester->dao->update(TABLE_CONFIG)->set('id')->eq($id)->where( 'id')->eq($configID)->exec(); r($config1) && p('value') && e('stop'); //修改配置项之后查看更新信息 r($config2) && p('value') && e('run'); //修改配置项之后查看更新信息 diff --git a/test/model/cron/parsecron.php b/test/model/cron/parsecron.php old mode 100644 new mode 100755 index bfcb7151ab..f288d827bd --- a/test/model/cron/parsecron.php +++ b/test/model/cron/parsecron.php @@ -10,13 +10,16 @@ title=测试 cronModel->parseCron(); cid=1 pid=1 +获取id为19的定时任务的定时信息和命令信息 >> moduleName=measurement&methodName=execCrontabQueue +获取id为15的定时任务的定时信息和命令信息 >> moduleName=execution&methodName=computeTaskEffort + */ $cron = new cronTest(); $crons = $tester->cron->getCrons('nostop'); $parse = $cron->parseCronTest($crons); -r($parse) && p('19:schema,command') && e('*/5 * * * *,moduleName=measurement&methodName=execCrontabQueue');//获取id为19的定时任务的定时信息和命令信息 -r($parse) && p('15:schema,command') && e('30 23 * * *,moduleName=execution&methodName=computeTaskEffort'); //获取id为15的定时任务的定时信息和命令信息 +r($parse) && p('19:command') && e('moduleName=measurement&methodName=execCrontabQueue');//获取id为19的定时任务的定时信息和命令信息 +r($parse) && p('15:command') && e('moduleName=execution&methodName=computeTaskEffort'); //获取id为15的定时任务的定时信息和命令信息 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/model/cron/runable.php b/test/model/cron/runable.php old mode 100644 new mode 100755 index 8e39324edf..71886cc585 --- a/test/model/cron/runable.php +++ b/test/model/cron/runable.php @@ -10,6 +10,12 @@ title=测试 cronModel->runable(); cid=1 pid=1 +cron配置为空情况 >> 0 +cron配置存在,执行时间大于最大可执行时间情况 >> 1 +cron状态为空情况 >> 1 +cron状态是stop情况 >> 1 +cron状态存在不是stop情况 >> 0 + */ $cron = new cronTest(); @@ -34,4 +40,4 @@ r($res1) && p() && e('0'); //cron配置为空情况 r($res2) && p() && e('1'); //cron配置存在,执行时间大于最大可执行时间情况 r($res3) && p() && e('1'); //cron状态为空情况 r($res4) && p() && e('1'); //cron状态是stop情况 -r($res5) && p() && e('0'); //cron状态存在不是stop情况 +r($res5) && p() && e('0'); //cron状态存在不是stop情况 \ No newline at end of file diff --git a/test/model/cron/update.php b/test/model/cron/update.php old mode 100644 new mode 100755 index f89fdfda33..1ad1a82988 --- a/test/model/cron/update.php +++ b/test/model/cron/update.php @@ -10,6 +10,10 @@ title=测试 cronModel->update(); cid=1 pid=1 +命令为空时候返回值 >> 『命令』不能为空 +更新之后对比更新数据信息 >> test comand,zentao +更新之后对比更新数据信息 >> 55,23,30,12,6 + */ $cron = new cronTest(); @@ -28,9 +32,8 @@ $result1 = $cron->updateTest($cronID, $cron1); $cron1->command = 'test comand'; $result2 = $cron->updateTest($cronID, $cron1); - r($result1[0]) && p() && e('『命令』不能为空'); //命令为空时候返回值 r($result2) && p('command,type') && e('test comand,zentao');//更新之后对比更新数据信息 r($result2) && p('m,h,dom,mon,dow') && e('55,23,30,12,6'); //更新之后对比更新数据信息 -system('./ztest init'); +system('./ztest init'); \ No newline at end of file diff --git a/test/ztest b/test/ztest index ab474ac993..94f0552c5c 100755 --- a/test/ztest +++ b/test/ztest @@ -60,6 +60,7 @@ switch($argv[1]) break; case 'my': ztfRun('model/my'); + break; case 'caselib': ztfRun('model/caselib'); break; From 0b8768c1d64f4851d36da6b0183cbcd38dfe1fac Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Wed, 6 Apr 2022 10:48:24 +0800 Subject: [PATCH 14/39] update action data --- test/data/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/data/action.yaml b/test/data/action.yaml index 9265a3789f..5303274c78 100644 --- a/test/data/action.yaml +++ b/test/data/action.yaml @@ -65,7 +65,7 @@ fields: format: "" - field: extra note: "附加参数" - range: "0" + range: 1{4},11,1{22},33,1{22},101,1{22},131,1{22},161,1{3} prefix: "" postfix: "" loop: 0 From 4b87e078304add271e8630f1ae478822e60662af Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 04:16:24 +0000 Subject: [PATCH 15/39] * Finish task#51071 --- module/search/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/search/model.php b/module/search/model.php index f7ebc34a88..69167fcf7e 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -548,12 +548,12 @@ class searchModel extends model $trimedWord = trim($splitedWords['words']); $against .= '"' . $trimedWord . '" '; $againstCond .= '+"' . $trimedWord . '" '; - if(is_numeric($word) and strlen($word) == 5) $againstCond .= "-\" $word \" "; + if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) == 5) $againstCond .= "-\" $word \" "; $likeWord = is_numeric($word) ? $word : $trimedWord; - if(is_numeric($word) and strlen($word) < 5) $likeWord = str_pad("|$likeWord|", 5, '_'); + if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) < 5) $likeWord = str_pad("|$likeWord|", 5, '_'); $condition = "OR title like '%{$likeWord}%' OR content like '%{$likeWord}%'"; - if(is_numeric($word) and strlen($word) == 5) $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; + if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) == 5) $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; $likeCondition .= $condition; } From 4f5529867bef9a8bbb8842bfb9d5f54e434281df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 6 Apr 2022 13:13:29 +0800 Subject: [PATCH 16/39] * code for bug #20933. --- module/execution/control.php | 2 +- module/project/control.php | 2 +- module/project/model.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 98c1b23534..74e9c7da44 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3261,7 +3261,7 @@ class execution extends control * @access public * @return void */ - public function all($status = 'all', $projectID = 0, $orderBy = 'order_asc', $productID = 0, $recTotal = 0, $recPerPage = 10, $pageID = 1) + public function all($status = 'all', $projectID = 0, $orderBy = 'order_asc', $productID = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1) { $this->app->loadLang('my'); $this->app->loadLang('product'); diff --git a/module/project/control.php b/module/project/control.php index 843bf13a32..67d0753b65 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -910,7 +910,7 @@ class project extends control * @access public * @return void */ - public function execution($status = 'all', $projectID = 0, $orderBy = 'order_asc', $productID = 0, $recTotal = 0, $recPerPage = 10, $pageID = 1) + public function execution($status = 'all', $projectID = 0, $orderBy = 'order_asc', $productID = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1) { $uri = $this->app->getURI(true); $this->app->session->set('executionList', $uri, 'project'); diff --git a/module/project/model.php b/module/project/model.php index bd466543f9..3fbca9bb4f 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1960,7 +1960,7 @@ class projectModel extends model * @param string $orderBy * @param object $pager * @access public - * @return void + * @return array */ public function getStats($projectID = 0, $status = 'undone', $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'id_asc', $pager = null) { From 8e0fc555c802a6a965bffbfa160b0a675daee6ec Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 05:19:30 +0000 Subject: [PATCH 17/39] * Fix bug#11398 --- module/product/view/browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 15a4aa1e81..74e7846d61 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -401,7 +401,7 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : ''; $misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink', '', '#productStoryForm')\"" : ''; echo "
  • " . html::a('#', $lang->close, '', $misc) . "
  • "; - if($canBatchUnlink) echo "
  • " . html::a('#', $lang->story->unlink, '', "id='batchUnlinkStory'") . "
  • "; + if($canBatchUnlink) echo '
  • ' . html::a('#', $lang->story->unlink, '', "id='batchUnlinkStory'") . "
  • "; if($canBatchReview) { From 2da5d460cfd43b504c51cefeaf15b7ae5121475b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 6 Apr 2022 05:25:14 +0000 Subject: [PATCH 18/39] Update ztest --- test/ztest | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/ztest b/test/ztest index 94f0552c5c..9acae923fd 100755 --- a/test/ztest +++ b/test/ztest @@ -67,12 +67,6 @@ switch($argv[1]) case 'cron': ztfRun('model/cron'); break; - case 'caselib': - ztfRun('model/caselib'); - break; - case 'cron': - ztfRun('model/cron'); - break; case 'model': ztfRun('model'); break; From 3eb12785f1c343e2b463d9db498b46ff813f44eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 6 Apr 2022 13:37:19 +0800 Subject: [PATCH 19/39] *Fix bug#18381. --- module/caselib/view/createcase.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/caselib/view/createcase.html.php b/module/caselib/view/createcase.html.php index 864d900ff1..5f1e0ef23c 100644 --- a/module/caselib/view/createcase.html.php +++ b/module/caselib/view/createcase.html.php @@ -41,7 +41,7 @@ if(count($moduleOptionMenu) == 1) { echo ""; - echo html::a($this->createLink('tree', 'browse', "rootID=$libID&view=caselib¤tModuleID=0", 'html', true), "", '', "data-toggle='tooltip' class='btn iframe' title='{$lang->tree->manage}'"); + echo html::a($this->createLink('tree', 'browse', "rootID=$libID&view=caselib¤tModuleID=0", 'html', true), "", '', "data-toggle='tooltip' class='btn iframe' data-width='95%' title='{$lang->tree->manage}'"); echo ''; echo ""; echo html::a("javascript:void(0)", "", '', "class='btn refresh' title='{$lang->refresh}' onclick='loadLibModules($libID)'"); From d8ef00183bf0bf95e88706a575d8029a07cb9412 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 13:47:49 +0800 Subject: [PATCH 20/39] * Fix bug#17296. --- module/testreport/model.php | 7 +++++-- module/testtask/control.php | 14 ++++++-------- module/testtask/js/create.js | 1 - module/testtask/model.php | 14 -------------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/module/testreport/model.php b/module/testreport/model.php index 541f4ac595..cc9f765121 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -578,13 +578,16 @@ class testreportModel extends model * Get pairs. * * @param int $productID + * @param int $includedID * @access public * @return array */ - public function getPairs($productID = 0) + public function getPairs($productID = 0, $includedID = 0) { return $this->dao->select('id,title')->from(TABLE_TESTREPORT) - ->beginIF($productID)->where('product')->eq($productID)->fi() + ->where('deleted')->eq(0) + ->beginIF($productID)->andWhere('product')->eq($productID)->fi() + ->beginIF($includedID)->orWhere('id')->eq($includedID)->fi() ->orderBy('id_desc') ->fetchPairs(); } diff --git a/module/testtask/control.php b/module/testtask/control.php index 785a6c9384..557624257f 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -242,13 +242,12 @@ class testtask extends control } /* Create testtask from testtask of test.*/ - $productID = $productID ? $productID : key($this->products); - $executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID); - $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk'); - $testreports = $this->testtask->getTestReportPairsByBuild($build); + $productID = $productID ? $productID : key($this->products); + $executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID); + $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk'); /* Set menu. */ - $productID = $this->product->saveState($productID, $this->products); + $productID = $this->product->saveState($productID, $this->products); $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->create; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); @@ -261,7 +260,7 @@ class testtask extends control $this->view->executions = $executions; $this->view->builds = $builds; $this->view->build = $build; - $this->view->testreports = $testreports; + $this->view->testreports = array('') + $this->loadModel('testreport')->getPairs($productID); $this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted'); $this->display(); @@ -758,12 +757,11 @@ class testtask extends control $executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID); $executionID = $task->execution; $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk', $executionID, 'execution'); - $testreports = $this->loadModel('testreport')->getPairs($task->product); $this->view->task = $task; $this->view->executions = $executions; $this->view->builds = $builds; - $this->view->testreports = $testreports; + $this->view->testreports = $this->loadModel('testreport')->getPairs($task->product, $task->testreport); $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed', $task->owner); $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); diff --git a/module/testtask/js/create.js b/module/testtask/js/create.js index b893254a18..8e0df381da 100755 --- a/module/testtask/js/create.js +++ b/module/testtask/js/create.js @@ -38,6 +38,5 @@ function loadExecutions(productID) $(function() { adjustPriBoxWidth(); - loadTestReports($('#product').val()); if($('#execution').val() != 0) loadExecutionBuilds($('#execution').val()); }); diff --git a/module/testtask/model.php b/module/testtask/model.php index 3845a79242..76c13112a9 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -492,20 +492,6 @@ class testtaskModel extends model ->fetchAll(); } - /** - * Get test report pairs by build. - * - * @param string $build - * @access public - * @return array - */ - public function getTestReportPairsByBuild($build = '') - { - if(empty($build)) return array(); - - return $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where("CONCAT(',', builds, ',')")->like("%,$build,%")->fetchPairs('id','title'); - } - /** * Get related test tasks. * From c149ac6299499e35f3ade2f0be4b6fb81ab2c0f8 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 06:03:03 +0000 Subject: [PATCH 21/39] * Adjust code --- module/product/view/browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 74e7846d61..ace2c4d729 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -401,7 +401,7 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : ''; $misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink', '', '#productStoryForm')\"" : ''; echo "
  • " . html::a('#', $lang->close, '', $misc) . "
  • "; - if($canBatchUnlink) echo '
  • ' . html::a('#', $lang->story->unlink, '', "id='batchUnlinkStory'") . "
  • "; + if($canBatchUnlink) echo '
  • ' . html::a('#', $lang->story->unlink, '', "id='batchUnlinkStory'") . "
  • "; if($canBatchReview) { From 6cdf575678061fb3a33b3accfd27f94974f310cb Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 06:07:46 +0000 Subject: [PATCH 22/39] * Adjust code --- module/search/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/search/model.php b/module/search/model.php index 69167fcf7e..6cb1f2ddd9 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -548,12 +548,12 @@ class searchModel extends model $trimedWord = trim($splitedWords['words']); $against .= '"' . $trimedWord . '" '; $againstCond .= '+"' . $trimedWord . '" '; - if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) == 5) $againstCond .= "-\" $word \" "; + if(is_numeric($word) and strpos($word, '.') === false and strlen($word) == 5) $againstCond .= "-\" $word \" "; $likeWord = is_numeric($word) ? $word : $trimedWord; - if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) < 5) $likeWord = str_pad("|$likeWord|", 5, '_'); + if(is_numeric($word) and strpos($word, '.') === false and strlen($word) < 5) $likeWord = str_pad("|$likeWord|", 5, '_'); $condition = "OR title like '%{$likeWord}%' OR content like '%{$likeWord}%'"; - if(is_numeric($word) and (strpos($word, '.') === false) and strlen($word) == 5) $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; + if(is_numeric($word) and strpos($word, '.') === false and strlen($word) == 5) $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; $likeCondition .= $condition; } From badb961a37a5978a2d097e6c8b6503efc6e491f5 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 06:27:49 +0000 Subject: [PATCH 23/39] * Adjust code --- module/search/model.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/module/search/model.php b/module/search/model.php index 6cb1f2ddd9..5e6156e87e 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -545,15 +545,18 @@ class searchModel extends model { $splitedWords = $spliter->utf8Split($word); - $trimedWord = trim($splitedWords['words']); - $against .= '"' . $trimedWord . '" '; - $againstCond .= '+"' . $trimedWord . '" '; - if(is_numeric($word) and strpos($word, '.') === false and strlen($word) == 5) $againstCond .= "-\" $word \" "; + $trimedWord = trim($splitedWords['words']); + $against .= '"' . $trimedWord . '" '; + $againstCond .= '+"' . $trimedWord . '" '; - $likeWord = is_numeric($word) ? $word : $trimedWord; + $likeWord = is_numeric($word) ? $word : $trimedWord; if(is_numeric($word) and strpos($word, '.') === false and strlen($word) < 5) $likeWord = str_pad("|$likeWord|", 5, '_'); $condition = "OR title like '%{$likeWord}%' OR content like '%{$likeWord}%'"; - if(is_numeric($word) and strpos($word, '.') === false and strlen($word) == 5) $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; + if(is_numeric($word) and strpos($word, '.') === false and strlen($word) == 5) + { + $againstCond .= "-\" $word \" "; + $condition = "OR title REGEXP '[^ ]{$likeWord}[^ ]' OR content REGEXP '[^ ]{$likeWord}[^ ]'"; + } $likeCondition .= $condition; } From 0530b892e4ee4f1e9f1a81467d00cf56a5b5f25a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 6 Apr 2022 15:22:15 +0800 Subject: [PATCH 24/39] * Fix bug #18710. --- module/action/lang/en.php | 4 ++++ module/action/lang/zh-cn.php | 4 ++++ module/action/model.php | 4 ++-- module/execution/model.php | 1 + module/story/lang/en.php | 1 + module/story/lang/zh-cn.php | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 1a35c0fc70..915f2e3b8d 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -261,6 +261,7 @@ $lang->action->label->changestatus = 'changed status'; $lang->action->label->marked = 'marked'; $lang->action->label->linked2execution = "linked to {$lang->executionCommon}"; $lang->action->label->unlinkedfromexecution = "unlinked from {$lang->executionCommon}"; +$lang->action->label->linked2kanban = 'linked to kanban'; $lang->action->label->linked2project = "linked to project"; $lang->action->label->unlinkedfromproject = "unlinked from project"; $lang->action->label->unlinkedfrombuild = "unlinked Build "; @@ -422,6 +423,7 @@ $lang->action->dynamicAction->story['undeleted'] = 'Restore Story'; $lang->action->dynamicAction->story['hidden'] = 'Hide Story'; $lang->action->dynamicAction->story['linked2execution'] = "Link Story"; $lang->action->dynamicAction->story['unlinkedfromexecution'] = "Unlink Story"; +$lang->action->dynamicAction->story['linked2kanban'] = "Link Story"; $lang->action->dynamicAction->story['estimated'] = "Estimate $lang->SRCommon"; $lang->action->dynamicAction->execution['opened'] = 'Create ' . $lang->executionCommon; @@ -709,6 +711,7 @@ $lang->action->search->label['linked2project'] = $lang->action->label->li $lang->action->search->label['unlinkedfromproject'] = $lang->action->label->unlinkedfromproject; $lang->action->search->label['linked2execution'] = $lang->action->label->linked2execution; $lang->action->search->label['unlinkedfromexecution'] = $lang->action->label->unlinkedfromexecution; +$lang->action->search->label['linked2kanban'] = $lang->action->label->linked2kanban; $lang->action->search->label['started'] = $lang->action->label->started; $lang->action->search->label['restarted'] = $lang->action->label->restarted; $lang->action->search->label['recordestimate'] = $lang->action->label->recordestimate; @@ -790,6 +793,7 @@ $lang->action->apiTitle->changestatus = 'Changed status'; $lang->action->apiTitle->marked = 'Marked'; $lang->action->apiTitle->linked2execution = "Linked to {$lang->executionCommon}"; $lang->action->apiTitle->unlinkedfromexecution = "Unlinked from {$lang->executionCommon}"; +$lang->action->apiTitle->linked2kanban = 'Linked to Kanban'; $lang->action->apiTitle->linked2project = "Linked to project"; $lang->action->apiTitle->unlinkedfromproject = "Unlinked from project"; $lang->action->apiTitle->unlinkedfrombuild = "Unlinked from build"; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 20a58819da..211820ac1b 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -261,6 +261,7 @@ $lang->action->label->changestatus = '修改状态'; $lang->action->label->marked = '编辑了'; $lang->action->label->linked2execution = "关联{$lang->executionCommon}"; $lang->action->label->unlinkedfromexecution = "移除{$lang->executionCommon}"; +$lang->action->label->linked2kanban = '关联看板'; $lang->action->label->linked2project = "关联项目"; $lang->action->label->unlinkedfromproject = "移除项目"; $lang->action->label->unlinkedfrombuild = "移除版本"; @@ -422,6 +423,7 @@ $lang->action->dynamicAction->story['undeleted'] = "还原{$lang->SR $lang->action->dynamicAction->story['hidden'] = "隐藏{$lang->SRCommon}"; $lang->action->dynamicAction->story['linked2execution'] = "关联$lang->SRCommon"; $lang->action->dynamicAction->story['unlinkedfromexecution'] = "移除$lang->SRCommon"; +$lang->action->dynamicAction->story['linked2kanban'] = "关联$lang->SRCommon"; $lang->action->dynamicAction->story['estimated'] = "估算$lang->SRCommon"; $lang->action->dynamicAction->execution['opened'] = '创建' . $lang->executionCommon; @@ -710,6 +712,7 @@ $lang->action->search->label['linked2project'] = $lang->action->label->li $lang->action->search->label['unlinkedfromproject'] = $lang->action->label->unlinkedfromproject; $lang->action->search->label['linked2execution'] = $lang->action->label->linked2execution; $lang->action->search->label['unlinkedfromexecution'] = $lang->action->label->unlinkedfromexecution; +$lang->action->search->label['linked2kanban'] = $lang->action->label->linked2kanban; $lang->action->search->label['started'] = $lang->action->label->started; $lang->action->search->label['restarted'] = $lang->action->label->restarted; $lang->action->search->label['recordestimate'] = $lang->action->label->recordestimate; @@ -791,6 +794,7 @@ $lang->action->apiTitle->changestatus = '修改状态'; $lang->action->apiTitle->marked = '编辑'; $lang->action->apiTitle->linked2execution = "关联{$lang->executionCommon}"; $lang->action->apiTitle->unlinkedfromexecution = "移除{$lang->executionCommon}"; +$lang->action->apiTitle->linked2kanban = '关联看板'; $lang->action->apiTitle->linked2project = "关联项目"; $lang->action->apiTitle->unlinkedfromproject = "移除项目"; $lang->action->apiTitle->unlinkedfrombuild = "移除版本"; diff --git a/module/action/model.php b/module/action/model.php index 40c55ee22d..1f7af1059e 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -289,7 +289,7 @@ class actionModel extends model } if($actionType == 'unlinkedfromproject' or $actionType == 'linked2project') $record['project'] = (int)$extra ; - if($actionType == 'unlinkedfromexecution' or $actionType == 'linked2execution') $record['execution'] = (int)$extra; + if(in_array($actionType, array('unlinkedfromexecution', 'linked2execution', 'linked2kanban'))) $record['execution'] = (int)$extra; if($record) { @@ -351,7 +351,7 @@ class actionModel extends model { $action->actor = $commiters[$action->actor]; } - elseif($actionName == 'linked2execution') + elseif($actionName == 'linked2execution' or $actionName == 'linked2kanban') { $execution = $this->dao->select('name,type')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch(); $name = $execution->name; diff --git a/module/execution/model.php b/module/execution/model.php index 04f011f8cd..b78e43efea 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2364,6 +2364,7 @@ class executionModel extends model $this->linkCases($executionID, (int)$products[$storyID], $storyID); $action = $executionID == $this->session->project ? 'linked2project' : 'linked2execution'; + if($action == 'linked2execution' and $execution->type == 'kanban') $action = 'linked2kanban'; $this->action->create('story', $storyID, $action, '', $executionID); } diff --git a/module/story/lang/en.php b/module/story/lang/en.php index d6e1c723cc..7c15156424 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -302,6 +302,7 @@ $lang->story->action->linked2plan = array('main' => '$date, linked by $lang->story->action->unlinkedfromplan = array('main' => '$date, unlinked by $actor from Plan $extra.'); $lang->story->action->linked2execution = array('main' => '$date, linked by $actor to ' . $lang->executionCommon . ' $extra.'); $lang->story->action->unlinkedfromexecution = array('main' => '$date, unlinked by $actor from ' . $lang->executionCommon . ' $extra.'); +$lang->story->action->linked2kanban = array('main' => '$date, linked by $actor to Kanban $extra.'); $lang->story->action->linked2project = array('main' => '$date, linked by $actor to project $extra.'); $lang->story->action->unlinkedfromproject = array('main' => '$date, unlinked by $actor from project $extra.'); $lang->story->action->linked2build = array('main' => '$date, linked by $actor to Build $extra'); diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 29d7a86098..9c0e7761d3 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -302,6 +302,7 @@ $lang->story->action->linked2plan = array('main' => '$date, 由 story->action->unlinkedfromplan = array('main' => '$date, 由 $actor 从计划 $extra 移除。'); $lang->story->action->linked2execution = array('main' => '$date, 由 $actor 关联到' . $lang->executionCommon . ' $extra。'); $lang->story->action->unlinkedfromexecution = array('main' => '$date, 由 $actor 从' . $lang->executionCommon . ' $extra 移除。'); +$lang->story->action->linked2kanban = array('main' => '$date, 由 $actor 关联到看板 $extra。'); $lang->story->action->linked2project = array('main' => '$date, 由 $actor 关联到项目 $extra。'); $lang->story->action->unlinkedfromproject = array('main' => '$date, 由 $actor 从项目 $extra 移除。'); $lang->story->action->linked2build = array('main' => '$date, 由 $actor 关联到版本 $extra。'); From a10b23a5c031ec7dd9eb34dc479f57f2f7e4adf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 6 Apr 2022 15:24:00 +0800 Subject: [PATCH 25/39] *Fix bug#21514. --- module/story/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index 6aedb9896b..e935521952 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3232,7 +3232,7 @@ class storyModel extends model if(isset($stories[$storyID]) and $stories[$storyID] > $storyVersionList[$key]) $objectList[$key]->needconfirm = true; } - return is_object($data) ? current($objectList) : $objectList; + return is_object($data) ? reset($objectList) : $objectList; } /** From d8774117b97ec779d96b65829d9fa77332d4d1f5 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 15:36:20 +0800 Subject: [PATCH 26/39] * Fix bug#21290. --- module/bug/control.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 83ad4815aa..68fd686a73 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -406,7 +406,8 @@ class bug extends control if(isset($output['executionID']) and isonlybody()) { $executionID = $this->post->execution ? $this->post->execution : $output['executionID']; - if($executionID == $output['executionID'] and $this->app->tab == 'execution') + $execution = $this->loadModel('execution')->getByID($executionID); + if($executionID == $output['executionID'] and $this->app->tab == 'execution' and $execution->type == 'kanban') { $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $this->session->execLaneType ? $this->session->execLaneType : 'all'); $kanbanData = json_encode($kanbanData); @@ -414,7 +415,7 @@ class bug extends control } else { - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'locate' => 'parent')); } } From 261d23bc57ef35d461a8155e5d43bf8022cd5a08 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 07:36:22 +0000 Subject: [PATCH 27/39] * Fix bug#21135 --- www/js/my.full.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/js/my.full.js b/www/js/my.full.js index b819dcdb00..99b72bd5d9 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -897,12 +897,13 @@ $(document).ready(function() $('.has-avatar').hover(function() { $(this).next().removeClass('open'); + $(this).prev().removeClass('open'); }); /* Hide the avatar drop-down when hovering over the global create button. */ $('#globalCreate').hover(function() { - $(this).prev().removeClass('open'); + $(this).next().removeClass('open'); $(this).addClass('dropdown-hover'); }); From ae8728b5da5a2456db371f9260ced193679d15c3 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 6 Apr 2022 15:46:25 +0800 Subject: [PATCH 28/39] * Fix bug #20309. --- module/testcase/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/testcase/control.php b/module/testcase/control.php index b1a12d3eed..b5293c4997 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1866,6 +1866,8 @@ class testcase extends control if($_POST) { $this->testcase->createFromImport($productID, (int)$branch); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + if($this->post->isEndPage) { unlink($tmpFile); From 32ef589b422b510c62a7b2f69682d1ee346527b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 6 Apr 2022 07:59:30 +0000 Subject: [PATCH 29/39] Update processor.php --- test/data/zentao/processor.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index e75e4f3e14..d69b03d698 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -429,7 +429,5 @@ class Processor public function initSonPlan() { $this->dao->query("update zt_productplan set `parent` = '-1' where id < 10 and id > 0"); - } - } From c7762898157060a84aa3d5fbecdbff4681eb1867 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Wed, 6 Apr 2022 16:00:00 +0800 Subject: [PATCH 30/39] * Fix bug #16780. --- module/my/view/bug.html.php | 5 ++++- module/story/model.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index df4389c7d5..22af12fe81 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -109,7 +109,10 @@ pri?>' title='bug->priList, $bug->pri);?>'>bug->priList, $bug->pri)?> ' title='bug->confirmedList, $bug->confirmed);?>'>bug->confirmedList, $bug->confirmed)?> - createLink('bug', 'view', "bugID=$bug->id"), $bug->title, null, "style='color: $bug->color' title='{$bug->title}'");?> + + createLink('bug', 'view', "bugID=$bug->id"), $bug->title, null, "style='color: $bug->color' title='{$bug->title}'");?> + case) echo html::a(helper::createLink('testcase', 'view', "caseID=$bug->case&version=$bug->caseVersion"), "[" . $this->lang->testcase->common . "#$bug->case]", '', "class='bug' title='$bug->case'");?> + productLink == 'product-all' ? '' : "productID=$bug->product";?> $storyVersionList[$key]) $objectList[$key]->needconfirm = true; } - return is_object($data) ? current($objectList) : $objectList; + return is_object($data) ? reset($objectList) : $objectList; } /** From 8799957c7340bef6fdc456137322872fa5b731ec Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 08:00:21 +0000 Subject: [PATCH 31/39] * Fix bug#21218 --- module/bug/css/view.css | 1 + module/story/css/view.css | 1 + module/task/css/view.css | 1 + 3 files changed, 3 insertions(+) diff --git a/module/bug/css/view.css b/module/bug/css/view.css index 318cf5f0f7..d3e4181d63 100644 --- a/module/bug/css/view.css +++ b/module/bug/css/view.css @@ -3,3 +3,4 @@ .table-data tr > td {word-break: break-all; word-wrap: break-word;} .side-col .cell {padding: 0px;} .tab-pane table {border: 1px solid #ddd; border-top: none;} +.btn-edit-comment {z-index: 100;} diff --git a/module/story/css/view.css b/module/story/css/view.css index a8a0febfde..191a5b1f34 100644 --- a/module/story/css/view.css +++ b/module/story/css/view.css @@ -2,3 +2,4 @@ .side-col #legendProjectAndTask .list-unstyled {padding: 10px; border-top: 0px; margin: 0px;} #legendStories ul li {padding: 10px 0 0 12px; line-height: 20px;} .main-actions .btn-toolbar .btn {padding-right: 6px; padding-left: 6px;} +.btn-edit-comment {z-index: 100;} diff --git a/module/task/css/view.css b/module/task/css/view.css index 184f37b904..2b55ebf2d2 100644 --- a/module/task/css/view.css +++ b/module/task/css/view.css @@ -4,3 +4,4 @@ .page-title{max-width: 80%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} .pull-left{max-width: 80%;} .MRThWidth {width: 90px !important;} +.btn-edit-comment {z-index: 100;} From bd895ca2440c63c8053426de0e95367d276d99aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 6 Apr 2022 16:01:06 +0800 Subject: [PATCH 32/39] * Add project test and fix bug. --- module/project/model.php | 2 +- module/task/model.php | 2 + test/class/project.class.php | 313 ++---------------- test/model/program/create.php | 2 - test/model/project/buildmenuquery.php | 18 + test/model/project/checkhaschildren.php | 2 +- test/model/project/create.php | 62 ++++ test/model/project/getbranchesbyproject.php | 21 ++ .../model/project/getbranchgroupbyproject.php | 21 ++ test/model/project/getbudgetunitlist.php | 8 +- test/model/project/getbyid.php | 27 +- test/model/project/getbyidlist.php | 8 +- test/model/project/getinfolist.php | 22 +- test/model/project/getmultilinkedproducts.php | 22 ++ test/model/project/getoverviewlist.php | 26 +- test/model/project/getpairsbyidlist.php | 15 +- test/model/project/getpairsbymodel.php | 19 ++ test/model/project/getpairsbyprogram.php | 31 +- test/model/project/getparentname.php | 24 -- test/model/project/getparentprogram.php | 25 ++ test/model/project/getprojectsconsumed.php | 18 +- test/model/project/getstatdata.php | 17 +- test/model/project/getstoriesbyproject.php | 20 ++ test/model/project/getswitcher.php | 5 +- test/model/project/gettotalbugbyproject.php | 15 +- .../project/gettotalstoriesbyproject.php | 14 +- test/model/project/gettotaltaskbyproject.php | 23 ++ test/model/project/gettreemenu.php | 19 ++ test/model/project/getworkhour.php | 11 +- test/model/project/isclickable.php | 5 +- test/model/project/savestate.php | 10 +- 31 files changed, 387 insertions(+), 440 deletions(-) create mode 100644 test/model/project/buildmenuquery.php create mode 100644 test/model/project/create.php create mode 100644 test/model/project/getbranchesbyproject.php create mode 100644 test/model/project/getbranchgroupbyproject.php create mode 100644 test/model/project/getmultilinkedproducts.php create mode 100644 test/model/project/getpairsbymodel.php delete mode 100755 test/model/project/getparentname.php create mode 100644 test/model/project/getparentprogram.php create mode 100644 test/model/project/getstoriesbyproject.php create mode 100644 test/model/project/gettotaltaskbyproject.php create mode 100644 test/model/project/gettreemenu.php diff --git a/module/project/model.php b/module/project/model.php index bd466543f9..f96ea05e27 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -851,7 +851,7 @@ class projectModel extends model if(isset($project->budget) and $program->budget != 0) { $availableBudget = $this->loadModel('program')->getBudgetLeft($program); - if($project->budget > $availableBudget) dao::$errors['budget'] = $this->lang->program->beyondParentBudget; + if($availableBudget > 0 and $project->budget > $availableBudget) dao::$errors['budget'] = $this->lang->program->beyondParentBudget; } /* Judge products not empty. */ diff --git a/module/task/model.php b/module/task/model.php index 5316974064..55d3ecc2e6 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -883,6 +883,8 @@ class taskModel extends model */ public function update($taskID) { + if($taskID <= 0) return; + $oldTask = $this->getByID($taskID); if($this->post->estimate < 0 or $this->post->left < 0 or $this->post->consumed < 0) { diff --git a/test/class/project.class.php b/test/class/project.class.php index 45fa017f41..82971993f9 100644 --- a/test/class/project.class.php +++ b/test/class/project.class.php @@ -8,11 +8,10 @@ class Project * @access public * @return void */ - public function __construct($user) + public function __construct() { global $tester; - su($user); $this->project = $tester->loadModel('project'); } @@ -36,18 +35,6 @@ class Project return true; } - /** - * checkHasChildren - * - * @param int mixed $projectID - * @access public - * @return void - */ - public function checkHasChildren($projectID) - { - return $this->project->checkHasChildren($projectID); - } - /** * checkStatusOff * @@ -74,136 +61,6 @@ class Project return true; } - /** - * checkBudgetUnitList - * - * @param string $checkList - * @param 'USD' => '美元') $'USD' => '美元') - * @access public - * @return void - */ - public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元')) - { - $budgetList = $this->project->getBudgetUnitList(); - foreach($budgetList as $enBudget => $zhBudget) - { - if($checkList[$enBudget] != $zhBudget) return false; - } - return true; - } - - /** - * getByIdList - * - * @param array mixed $projectIdList - * @param int mixed $count - * @access public - * @return void - */ - public function getByIdList($projectIdList, $count) - { - $projectList = $this->project->getByIdList($projectIdList); - if(count($projectList) != $count) return false; - return $projectList; - } - - /** - * getProjectByID - * - * @param int mixed $projectID - * @access public - * @return void - */ - public function getProjectByID($projectID) - { - return $this->project->getByID($projectID); - } - - /** - * getProgramByID - * - * @param int mixed $programID - * @access public - * @return void - */ - public function getProgramByID($programID) - { - return $this->project->getByID($programID, 'program'); - } - - - /** - * getSprintByID - * - * @param int mixed $sprintID - * @access public - * @return void - */ - public function getSprintByID($sprintID) - { - return $this->project->getByID($sprintID, 'sprint'); - } - - /** - * getStageByID - * - * @param int mixed $stageID - * @access public - * @return void - */ - public function getStageByID($stageID) - { - return $this->project->getByID($stageID, 'stage'); - } - - /** - * getKanbanByID - * - * @param int mixed $kanbanID - * @access public - * @return void - */ - public function getKanbanByID($kanbanID) - { - return $this->project->getByID($kanbanID, 'kanban'); - } - - /** - * getBystatus - * - * @param string mixed $status - * @access public - * @return void - */ - public function getBystatus($status) - { - $projects = $this->project->getOverviewList('byStatus', $status); - if(!$projects) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - if($status == 'undone') $status = 'wait,doing,suspended'; - - foreach($projects as $project) - { - if(strpos(",$status,", $project->status) === false) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'Error data.'; - - return $result; - } - } - - return count($projects); - } - /** * getListByOrder * @@ -229,54 +86,6 @@ class Project return $this->project->getOverviewList('byID', $projectID); } - /** - * getByIdListFind - * - * @param array mixed $IDList - * @access public - * @return void - */ - public function getByIdListFind($IDList) - { - $projects = $this->project->getPairsByIdList($IDList); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - foreach($projects as $projectID => $projectName) - { - if(!empty($IDList) and !in_array($projectID, $IDList)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'Error Data.'; - - return $result; - } - } - - return count($projects); - } - - /** - * getParentName - * - * @param int mixed $projectID - * @access public - * @return void - */ - public function getParentName($projectID) - { - $program = $this->project->getParentName($projectID); - if(empty($program)) return false; - return $program; - } - /** * getTeamMemberPairs * @@ -408,63 +217,6 @@ class Project return $releases; } - /** - * getByProgram - * - * @param int mixed $programID - * @access public - * @return void - */ - public function getByProgram($programID) - { - $projects = $this->project->getPairsByProgram($programID); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - return count($projects); - } - - /** - * getByStatusPairs - * - * @param string mixed $status - * @access public - * @return void - */ - public function getByStatusPairs($status) - { - $projects = $this->project->getPairsByProgram(2, $status); - if(empty($projects)) - { - $result = array(); - $result['code'] = 'fail'; - $result['message'] = 'No data.'; - - return $result; - } - - return count($projects); - } - - /** - * getConsumed - * - * @param array mixed $projectIdList - * @access public - * @return void - */ - public function getConsumed($projectIdList) - { - $projects = $this->project->getProjectsConsumed($projectIdList, $time = ''); - return $projects; - } - /** * getByStatusExe * @@ -504,46 +256,6 @@ class Project return count($executions); } - /** - * getTotalBugBy - * - * @param array mixed $projectIdList - * @param string mixed $status - * @access public - * @return void - */ - public function getTotalBugBy($projectIdList, $status) - { - $projects = $this->project->getTotalBugByProject($projectIdList, $status); - return $projects; - } - - /** - * getWorkHour - * - * @param int mixed $projectID - * @access public - * @return void - */ - public function getWorkHour($projectID) - { - $projects = $this->project->getWorkhour($projectID); - return $projects; - } - - /** - * getInfoList - * - * @param string mixed $status - * @access public - * @return void - */ - public function getInfoList($status) - { - $projects = $this->project->getInfoList($status); - return $projects; - } - /** * getStatData * @@ -573,6 +285,25 @@ class Project return $projects; } + /** + * Test create project. + * + * @param array $params + * @access public + * @return void + */ + public function create($params) + { + $_POST = $params; + + $projectID = $this->project->create(); + unset($_POST); + + if(dao::isError()) return array('message' => dao::getError()); + + return $this->project->getById($projectID); + } + /** * saveState * @@ -583,9 +314,7 @@ class Project public function saveState($projectID) { $projects = $this->project->getPairsByProgram(); - $object = $this->project->saveState($projectID, $projects); + $object = $this->project->saveState($projectID, $projects); return $object; } - } -?> diff --git a/test/model/program/create.php b/test/model/program/create.php index 2482bf3a23..948d580e5d 100755 --- a/test/model/program/create.php +++ b/test/model/program/create.php @@ -52,8 +52,6 @@ $moreThanParent['parent'] = '1'; $moreThanParent['begin'] = '2018-01-01'; $moreThanParent['end'] = '2022-02-10'; -$add_itemset = array('1', '2', '3', '4', '5', '6'); - r($program->create($normalProgram)) && p('name') && e('测试新增项目集一'); // 创建新项目集 r($program->create($emptyNameProgram)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 项目集名称为空时 r($program->create($emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 项目集的开始时间为空 diff --git a/test/model/project/buildmenuquery.php b/test/model/project/buildmenuquery.php new file mode 100644 index 0000000000..26d9f1f57e --- /dev/null +++ b/test/model/project/buildmenuquery.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +buildMenuQuery(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +r(strlen($tester->project->buildMenuQuery(11))) && p() && e('231'); // 获取构建的查询项目的sql的字符串长度 +r(strlen($tester->project->buildMenuQuery(100))) && p() && e('233'); // 获取构建的查询项目的sql的字符串长度 diff --git a/test/model/project/checkhaschildren.php b/test/model/project/checkhaschildren.php index d4fd3638b6..646ee19b36 100755 --- a/test/model/project/checkhaschildren.php +++ b/test/model/project/checkhaschildren.php @@ -19,4 +19,4 @@ $project = new Project('admin'); $getID = array(1, 101); r($project->checkHasChildren($getID[0])) && p() && e('1'); //获取id为1的项目是否有子项目 -r($project->checkHasChildren($getID[1])) && p() && e('0'); //获取id为101的项目是否有子项目 \ No newline at end of file +r($project->checkHasChildren($getID[1])) && p() && e('0'); //获取id为101的项目是否有子项目 diff --git a/test/model/project/create.php b/test/model/project/create.php new file mode 100644 index 0000000000..0f814dde31 --- /dev/null +++ b/test/model/project/create.php @@ -0,0 +1,62 @@ +#!/usr/bin/env php +> 测试新增项目一 +项目名称为空时 >> 『项目名称』不能为空。 +项目的开始时间为空 >> 『计划开始』不能为空。 +项目的完成时间为空 >> 『计划完成』不能为空。 +项目的计划完成时间大于计划开始时间 >> 『计划完成』应当大于『2022-01-12』。 +项目的完成日期大于父项目的完成日期(需要实时更新日期) >> 父项目的开始日期:2022-01-16,开始日期不能小于父项目的开始日期 + +*/ + +$project = new Project(); + +$data = array( + 'parent' => 1, + 'name' => '测试新增项目一', + 'budget' => '', + 'budgetUnit' => 'CNY', + 'begin' => '2022-02-03', + 'end' => '2022-03-01', + 'desc' => '测试项目描述', + 'acl' => 'private', + 'whitelist' => '', + 'PM' => '', + 'products' => array(1) +); + +$normalProject = $data; + +$emptyNameProject = $data; +$emptyNameProject['name'] = ''; + +$emptyBeginProject = $data; +$emptyBeginProject['begin'] = ''; + +$emptyEndProject = $data; +$emptyEndProject['end'] = ''; + +$beginGtEndProject = $data; +$beginGtEndProject['end'] = '2022-01-10'; + +$moreThanParent = $data; +$moreThanParent['parent'] = '1'; +$moreThanParent['begin'] = '2018-01-01'; + +r($project->create($normalProject)) && p('name') && e('测试新增项目一'); // 创建新项目 +r($project->create($emptyNameProject)) && p('message[name]:0') && e('『项目名称』不能为空。'); // 项目名称为空时 +r($project->create($emptyBeginProject)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 项目的开始时间为空 +r($project->create($emptyEndProject)) && p('message[end]:0') && e('『计划完成』不能为空。'); // 项目的完成时间为空 +r($project->create($beginGtEndProject)) && p('message[end]:0') && e('『计划完成』应当大于『2022-01-12』。'); // 项目的计划完成时间大于计划开始时间 +r($project->create($moreThanParent)) && p('message:begin;message:end') && e('父项目的开始日期:2022-01-16,开始日期不能小于父项目的开始日期'); // 项目的完成日期大于父项目的完成日期(需要实时更新日期) +system("./ztest init"); diff --git a/test/model/project/getbranchesbyproject.php b/test/model/project/getbranchesbyproject.php new file mode 100644 index 0000000000..6550b8eff8 --- /dev/null +++ b/test/model/project/getbranchesbyproject.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getBranchesByProject(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +$projectIdList = array(11, 12, 13); + +r(count($tester->project->getBranchesByProject(11))) && p('') && e('3'); // 获取id为11的项目的关联产品的分支数组数量,按产品分组 +r(key($tester->project->getBranchesByProject(11))) && p('') && e('1'); // 获取id为11的项目的关联产品的分支数组,获取第一个数组的键 +r(count($tester->project->getBranchesByProject(12))) && p('') && e('3'); // 获取id为12的项目的关联产品的分支数组数量,按产品分组 diff --git a/test/model/project/getbranchgroupbyproject.php b/test/model/project/getbranchgroupbyproject.php new file mode 100644 index 0000000000..26ac63c1b0 --- /dev/null +++ b/test/model/project/getbranchgroupbyproject.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getBranchGroupByProject(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +$productIdList = array(1, 2, 3); + +r(count($tester->project->getBranchGroupByProject(11, $productIdList))) && p('') && e('1'); // 获取id为11的项目的关联产品的分支数组数量,按产品分组 +r(key($tester->project->getBranchGroupByProject(12, $productIdList))) && p('') && e('2'); // 获取id为11的项目的关联产品的分支数组,获取第一个数组的键 +r(count($tester->project->getBranchGroupByProject(13, $productIdList))) && p('') && e('1'); // 获取id为12的项目的关联产品的分支数组数量,按产品分组 diff --git a/test/model/project/getbudgetunitlist.php b/test/model/project/getbudgetunitlist.php index 31d6c0d020..db6ab2efc9 100755 --- a/test/model/project/getbudgetunitlist.php +++ b/test/model/project/getbudgetunitlist.php @@ -1,7 +1,6 @@ #!/usr/bin/env php checkBudgetUnitList()) && p() && e('1'); //检查翻译 \ No newline at end of file +global $tester; +$tester->loadModel('project'); + +r($tester->project->getBudgetUnitList()) && p('CNY,USD') && e('人民币,美元'); //获取系统中的货币单位 diff --git a/test/model/project/getbyid.php b/test/model/project/getbyid.php index 1aaae57c76..b82ad63236 100755 --- a/test/model/project/getbyid.php +++ b/test/model/project/getbyid.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); -$getId = array(11, 0, 1, 0, 101, 0, 131, 0, 161, 0); - -r($t->getProjectByID($getId[0])) && p('code,type') && e('project1,project'); //获取ID等于11的项目 -r($t->getProjectByID($getId[1])) && p('code,type') && e('0'); //获取不存在的项目 -r($t->getProgramByID($getId[2])) && p('code,type') && e('program1,program'); //获取ID等于1的项目集 -r($t->getProgramByID($getId[3])) && p('code,type') && e('0'); //获取不存在的项目集 -r($t->getSprintByID($getId[4])) && p('code,type') && e('project1,sprint'); //获取ID等于101的冲刺 -r($t->getSprintByID($getId[5])) && p('code,type') && e('0'); //获取不存在的冲刺 -r($t->getStageByID($getId[6])) && p('code,type') && e('project31,stage'); //获取ID等于131的阶段 -r($t->getStageByID($getId[7])) && p('code,type') && e('0'); //获取不存在的阶段 -r($t->getKanbanByID($getId[8])) && p('code,type') && e('project61,kanban'); //获取ID等于161的阶段 -r($t->getKanbanByID($getId[9])) && p('code,type') && e('0'); //获取不存在的看板 \ No newline at end of file +r($tester->project->getByID(11, 'project')) && p('code,type') && e('project1,project'); //获取ID等于11的项目 +r($tester->project->getByID(0, 'project')) && p('code,type') && e('0'); //获取不存在的项目 +r($tester->project->getByID(1, 'program')) && p('code,type') && e('program1,program'); //获取ID等于1的项目集 +r($tester->project->getByID(0, 'program')) && p('code,type') && e('0'); //获取不存在的项目集 +r($tester->project->getByID(101, 'sprint')) && p('code,type') && e('project1,sprint'); //获取ID等于101的冲刺 +r($tester->project->getByID(0, 'sprint')) && p('code,type') && e('0'); //获取不存在的冲刺 +r($tester->project->getByID(131, 'stage')) && p('code,type') && e('project31,stage'); //获取ID等于131的阶段 +r($tester->project->getByID(0, 'stage')) && p('code,type') && e('0'); //获取不存在的阶段 +r($tester->project->getByID(161, 'kanban')) && p('code,type') && e('project61,kanban'); //获取ID等于161的阶段 +r($tester->project->getByID(0, 'kanban')) && p('code,type') && e('0'); //获取不存在的看板 diff --git a/test/model/project/getbyidlist.php b/test/model/project/getbyidlist.php index 025a1555bc..51eafaf97f 100755 --- a/test/model/project/getbyidlist.php +++ b/test/model/project/getbyidlist.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); $projectIdList = array(11,12,13); -r(($t->getByIdList($projectIdList, 3))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称 \ No newline at end of file +r(($tester->project->getByIdList($projectIdList))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称 diff --git a/test/model/project/getinfolist.php b/test/model/project/getinfolist.php index cfda53c84d..2e0159c408 100755 --- a/test/model/project/getinfolist.php +++ b/test/model/project/getinfolist.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); -$t_status = array('doing', 'wait', 'suspended', 'closed', 'all'); +$doingProjects = $tester->project->getInfoList('doing'); +$waitProjects = $tester->project->getInfoList('wait'); +$suspendedProjects = $tester->project->getInfoList('suspended'); +$closedProjects = $tester->project->getInfoList('closed'); +$allProjects = $tester->project->getInfoList('all'); -//var_dump($project->getInfoList('all'));die; -r($project->getInfoList($t_status[0])) && p() && e('0'); //查询正在进行的项目 -r($project->getInfoList($t_status[1])) && p('11:name') && e('项目1'); //查询等待状态的项目 -r($project->getInfoList($t_status[2])) && p() && e('0'); //查询暂停状态的项目 -r($project->getInfoList($t_status[3])) && p() && e('0'); //查询关闭状态的项目 -r($project->getInfoList($t_status[4])) && p('11:name') && e('项目1'); //查询所有状态的项目 \ No newline at end of file +r(count($doingProjects)) && p() && e('44'); //查询正在进行的项目数量 +r($waitProjects) && p('11:name') && e('项目1'); //查询wait状态的Id为11的项目名称 +r(count($suspendedProjects)) && p() && e('11'); //查询暂停状态的项目数量 +r(count($closedProjects)) && p() && e('11'); //查询关闭状态的项目数量 +r(count($allProjects)) && p() && e('110'); //查询所有状态的项目数量 diff --git a/test/model/project/getmultilinkedproducts.php b/test/model/project/getmultilinkedproducts.php new file mode 100644 index 0000000000..93ca8be7e7 --- /dev/null +++ b/test/model/project/getmultilinkedproducts.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +loadModel('project'); + +$products1 = $tester->project->getMultiLinkedProducts(1); +$products2 = $tester->project->getMultiLinkedProducts(11); + +r(count($products1)) && p() && e('0'); //查询项目1的关联产品数量 +r(count($products2)) && p() && e('3'); //查询项目11的关联产品数量 +r($products2) && p('1,91,81') && e('正常产品1,多平台产品91,多平台产品81'); //查询项目11关联的产品名称 diff --git a/test/model/project/getoverviewlist.php b/test/model/project/getoverviewlist.php index 6004dea5ed..e4ef52b1c7 100755 --- a/test/model/project/getoverviewlist.php +++ b/test/model/project/getoverviewlist.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); -$P_status = array('wait', 'undone', 11, 10000, 'id_asc', 'name_desc'); +$byStatus1 = $tester->project->getOverviewList('byStatus', 'wait'); +$byStatus2 = $tester->project->getOverviewList('byStatus', 'undone'); -r($t->getByStatus($P_status[0])) && p() && e('15'); // 获取未开始的项目 -r($t->getByStatus($P_status[1])) && p() && e('15'); // 获取状态不为done和closed的项目 -r($t->getByID($P_status[2])) && p('11:id') && e('11'); // 根据项目ID获取项目详情 -r($t->getByID($P_status[3])) && p('id') && e('0'); // 获取不存在的项目 -r($t->getListByOrder($P_status[4])) && p() && e('1'); //按照ID正序获取项目列表 -r($t->getListByOrder($P_status[5])) && p() && e('1'); // 按照项目名称倒序获取项目列表 \ No newline at end of file +$byId1 = $tester->project->getOverviewList('byid', '11'); +$byId2 = $tester->project->getOverviewList('byid', '10000'); + +$byOrder1 = $tester->project->getOverviewList('byStatus', 'all', 'id_asc'); +$byOrder2 = $tester->project->getOverviewList('byStatus', 'all', 'name_desc'); + +r(count($byStatus1)) && p() && e('15'); // 获取未开始的项目数量 +r(count($byStatus2)) && p() && e('15'); // 获取状态不为done和closed的项目数量 +r(count($byId1)) && p() && e('1'); // 根据项目ID获取项目 +r(count($byId2)) && p() && e('0'); // 获取不存在的项目 +r(current($byOrder1)) && p('id,name') && e('11,项目1'); // 按照ID正序获取项目列表,查看排第一个的项目详情 +r(current($byOrder2)) && p('id,name') && e('100,项目90'); // 按照项目名称倒序获取项目列表,查看排第一个的项目详情 diff --git a/test/model/project/getpairsbyidlist.php b/test/model/project/getpairsbyidlist.php index 1ecc019e2e..309885c4ee 100755 --- a/test/model/project/getpairsbyidlist.php +++ b/test/model/project/getpairsbyidlist.php @@ -1,11 +1,11 @@ #!/usr/bin/env php getPairsByIdList(); cid=1 pid=1 @@ -14,10 +14,9 @@ pid=1 */ -$project = new Project('admin'); +global $tester; +$tester->loadModel('project'); +$projectIdList = array(0, 11, 12, 13); -$findProject = array(0,11,12,13); -$findAllPro = array(); - -r($project->getByIdListFind($findProject)) && p() && e('3'); //查找ID为0、11、12、13的项目 -r($project->getByIdListFind($findAllPro)) && p() && e('90'); //查找所有项目 \ No newline at end of file +r(count($tester->project->getPairsByIdList($projectIdList))) && p() && e('3'); //查找ID为0、11、12、13的项目数量 +r(count($tester->project->getPairsByIdList(array()))) && p() && e('110'); //查找所有项目数量 diff --git a/test/model/project/getpairsbymodel.php b/test/model/project/getpairsbymodel.php new file mode 100644 index 0000000000..f1528f851e --- /dev/null +++ b/test/model/project/getpairsbymodel.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getPairsByModel(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +r(count($tester->project->getPairsByModel('all', 1))) && p() && e('9'); // 获取项目集1下的所有项目数量 +r($tester->project->getPairsByModel('all', 1)) && p('21') && e('项目集1 / 项目11'); // 获取项目集1下的项目名称 +r(count($tester->project->getPairsByModel('waterfall', 1))) && p() && e('3'); // 获取项目集1下的所有瀑布项目数量 diff --git a/test/model/project/getpairsbyprogram.php b/test/model/project/getpairsbyprogram.php index c9bb509194..216aba2df7 100755 --- a/test/model/project/getpairsbyprogram.php +++ b/test/model/project/getpairsbyprogram.php @@ -1,36 +1,23 @@ #!/usr/bin/env php getPairsByProgram(); cid=1 pid=1 -查找管理员可查看的所有项目 >> 90 -查找独立项目 >> No data. -查找管理员可查看的所属项目集ID为1的项目 >> 9 -查找管理员可查看的所属项目集ID为1且状态为wait的项目 >> 3 -查找管理员可查看的所属项目集ID为1且状态不为closed的项目 >> 7 - */ -/* - public function getListByOrder($orderBy) - { - $projects = $this->project->getPairsByProgram(3, 'doing', $orderBy); - return checkOrder($projects, $orderBy); - } -}*/ - -$t = new Project('admin'); +global $tester; +$tester->loadModel('project'); $t_project = array('', 0, 1, 'wait', 'noclosed'); -r($t->getByProgram($t_project[0])) && p() && e('90'); //查找管理员可查看的所有项目 -r($t->getByProgram($t_project[1])) && p() && e('No data.'); //查找独立项目 -r($t->getByProgram($t_project[2])) && p() && e('9'); //查找管理员可查看的所属项目集ID为1的项目 -r($t->getByStatusPairs($t_project[3])) && p() && e('3'); //查找管理员可查看的所属项目集ID为1且状态为wait的项目 -r($t->getByStatusPairs($t_project[4])) && p() && e('7'); //查找管理员可查看的所属项目集ID为1且状态不为closed的项目 \ No newline at end of file +r(count($tester->project->getPairsByProgram('', 'all', true))) && p() && e('110'); // 查找管理员可查看的所有项目数量 +r(count($tester->project->getPairsByProgram(0))) && p() && e('20'); // 查找独立项目数量 +r(count($tester->project->getPairsByProgram(1))) && p() && e('9'); // 查找管理员可查看的所属项目集ID为1的项目数量 +r(count($tester->project->getPairsByProgram(1, 'wait'))) && p() && e('3'); // 查找管理员可查看的所属项目集ID为1且状态为wait的项目数量 +r(count($tester->project->getPairsByProgram(1, 'noclosed'))) && p() && e('9'); // 查找管理员可查看的所属项目集ID为1且状态不为closed的项目数量 diff --git a/test/model/project/getparentname.php b/test/model/project/getparentname.php deleted file mode 100755 index 796627e8be..0000000000 --- a/test/model/project/getparentname.php +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env php -> 项目集1 -获取id为1的项目父项目名字 >> 项目集1 -获取id为0的项目父项目名字 >> 0 - -*/ - -$project = new Project('admin'); - -$getName = array(11, 1, 0); - -r($project->getParentName($getName[0])) && p('name') && e('项目集1'); //获取id为11的项目父项目名字 -r($project->getParentName($getName[1])) && p('name') && e('项目集1'); //获取id为1的项目父项目名字 -r($project->getParentName($getName[2])) && p('name') && e('0'); //获取id为0的项目父项目名字 \ No newline at end of file diff --git a/test/model/project/getparentprogram.php b/test/model/project/getparentprogram.php new file mode 100644 index 0000000000..652287553a --- /dev/null +++ b/test/model/project/getparentprogram.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +> 项目集1 +获取id为1的项目父项目名字 >> 项目集1 +获取id为0的项目父项目名字 >> 0 + +*/ + +global $tester; +$tester->loadModel('project'); + +$project1 = $tester->project->getById(11); +$project2 = $tester->project->getById(1); + +r($tester->project->getParentProgram($project1)) && p('name') && e('项目集1'); // 获取id为11的项目父项目名字 +r($tester->project->getParentProgram($project2)) && p('name') && e('0'); // 获取id为1的项目父项目名字 diff --git a/test/model/project/getprojectsconsumed.php b/test/model/project/getprojectsconsumed.php index 9316dd3d84..ed1bb44432 100755 --- a/test/model/project/getprojectsconsumed.php +++ b/test/model/project/getprojectsconsumed.php @@ -1,7 +1,7 @@ #!/usr/bin/env php getConsumed());die; >> 21.0 - >> 28.0 - >> 35.0 - */ -$projects = new Project('admin'); +global $tester; +$tester->loadModel('project'); -$getConsumed = array(11, 12, 13); +$projectIdList = array(11, 12, 13); -//var_dump($projects->getConsumed($getConsumed));die; -r($projects->getConsumed($getConsumed)) && p('11:totalConsumed') && e('21.0'); -r($projects->getConsumed($getConsumed)) && p('12:totalConsumed') && e('28.0'); -r($projects->getConsumed($getConsumed)) && p('13:totalConsumed') && e('35.0'); \ No newline at end of file +r($tester->project->getProjectsConsumed($projectIdList)) && p('11:totalConsumed') && e('21.0'); // 批量获取各个项目的总计消耗工时 +r($tester->project->getProjectsConsumed($projectIdList)) && p('12:totalConsumed') && e('28.0'); // 批量获取各个项目的总计消耗工时 +r($tester->project->getProjectsConsumed($projectIdList)) && p('13:totalConsumed') && e('35.0'); // 批量获取各个项目的总计消耗工时 diff --git a/test/model/project/getstatdata.php b/test/model/project/getstatdata.php index 4776452a6b..cb14e7274c 100755 --- a/test/model/project/getstatdata.php +++ b/test/model/project/getstatdata.php @@ -1,11 +1,11 @@ #!/usr/bin/env php getStatData(); cid=1 pid=1 @@ -17,10 +17,11 @@ pid=1 */ -$project = new Project('admin'); +global $tester; +$tester->loadModel('project'); -r($project->getStatData(13)) && p('bugCount') && e('3'); //统计id=13的项目bug数量 -r($project->getStatData(13)) && p('taskCount') && e('13'); //任务数量 -r($project->getStatData(13)) && p('waitCount') && e('2'); //暂停数量 -r($project->getStatData(13)) && p('doingCount') && e('2'); //进行的数量 -r($project->getStatData(13)) && p('finishedCount') && e('0'); //完成的数量 \ No newline at end of file +r($tester->project->getStatData(13)) && p('bugCount') && e('4'); //统计id=13的项目bug数量 +r($tester->project->getStatData(13)) && p('taskCount') && e('13'); //任务数量 +r($tester->project->getStatData(13)) && p('waitCount') && e('2'); //未开始数量 +r($tester->project->getStatData(13)) && p('doingCount') && e('2'); //进行的数量 +r($tester->project->getStatData(13)) && p('finishedCount') && e('0'); //完成的数量 diff --git a/test/model/project/getstoriesbyproject.php b/test/model/project/getstoriesbyproject.php new file mode 100644 index 0000000000..d35eaf147c --- /dev/null +++ b/test/model/project/getstoriesbyproject.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getStoriesByProject(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +$result = $tester->project->getStoriesByProject(11); + +r(count($result)) && p() && e('2'); // 获取项目11关联的所有产品数量 +r($result[91]) && p('0:project') && e('11'); // 获取项目11关联的产品ID为91的详情 diff --git a/test/model/project/getswitcher.php b/test/model/project/getswitcher.php index 1c11660186..704b49e03b 100755 --- a/test/model/project/getswitcher.php +++ b/test/model/project/getswitcher.php @@ -15,6 +15,5 @@ pid=1 $project = $tester->loadModel('project'); -//var_dump($project->getSwitcher(11, 'project', 'browse'));die; -r($project->getSwitcher(11, 'project', 'browse')) && p() && e('0'); //获取项目下拉菜单,项目列表页面没有项目下拉菜单 -r($project->getSwitcher(11, 'project', 'execution')) && p() && e("项目1"); //获取项目ID为11的迭代列表页面的项目下拉菜单,查看是否包含项目ID为11的名称 \ No newline at end of file +r($project->getSwitcher(11, 'project', 'browse')) && p() && e('0'); // 获取项目下拉菜单,项目列表页面没有项目下拉菜单 +r(strpos($project->getSwitcher(11, 'project', 'execution'), "项目1")) && p() && e('137'); // 获取项目ID为11的迭代列表页面的项目下拉菜单,查看项目1下拉框出现的位置 diff --git a/test/model/project/gettotalbugbyproject.php b/test/model/project/gettotalbugbyproject.php index 38f95e1f4d..44fe9a7fe6 100755 --- a/test/model/project/gettotalbugbyproject.php +++ b/test/model/project/gettotalbugbyproject.php @@ -1,11 +1,11 @@ #!/usr/bin/env php getTotalBugByProject(); cid=1 pid=1 @@ -13,11 +13,10 @@ pid=1 */ -$project = new Project('admin'); +global $tester; +$tester->loadModel('project'); -$getBug = array(11, 12, 13, 14, 15, 16, 27); +$projectIdList = array(11, 12, 13, 14, 15, 16, 27); -//var_dump($project->getTotalBugBy($getBug, 'active'));die; - -r($project->getTotalBugBy($getBug, 'active')) && p(11) && e('3'); //状态一致时正常打印id为11的项目bug数量 -r($project->getTotalBugBy($getBug, 'active')) && p(27) && e(''); //在状态status不一致的情况下,打印id为27的项目bug数量 \ No newline at end of file +r($tester->project->getTotalBugByProject($projectIdList, 'active')) && p('11') && e('4'); //获取id为11的项目下激活的bug数量 +r($tester->project->getTotalBugByProject($projectIdList, 'active')) && p('27') && e(''); //获取id为27的项目下激活的bug数量 diff --git a/test/model/project/gettotalstoriesbyproject.php b/test/model/project/gettotalstoriesbyproject.php index a3ddfc3e9b..2a8aff4196 100755 --- a/test/model/project/gettotalstoriesbyproject.php +++ b/test/model/project/gettotalstoriesbyproject.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); -var_dump($project->getTotalStoriesByProject());die; \ No newline at end of file +$productIdList = array(1, 2, 3); +$stories1 = $tester->project->getTotalStoriesByProject(11); +$stories2 = $tester->project->getTotalStoriesByProject(11, $productIdList); + +r($stories1) && p() && e('0'); // 不传入产品ID列表,获取项目11下的所有需求数量 +r($stories2) && p() && e('2'); // 传入产品ID列表,获取项目11下的所有需求数量 diff --git a/test/model/project/gettotaltaskbyproject.php b/test/model/project/gettotaltaskbyproject.php new file mode 100644 index 0000000000..0f8007bc18 --- /dev/null +++ b/test/model/project/gettotaltaskbyproject.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +getTotalTaskByProject(); +cid=1 +pid=1 + +状态一致时正常打印id为11的项目bug数量 >> 3 + +*/ + +global $tester; +$tester->loadModel('project'); + +$projectIdList = array(11, 12, 13, 14, 15, 16, 27); + +r($tester->project->getTotalTaskByProject($projectIdList, 'undone')) && p('11') && e('14'); // 获取id为11的项目下激活的task数量 +r($tester->project->getTotalTaskByProject($projectIdList, 'done')) && p('15') && e('2'); // 获取id为15的项目下完成的task数量 +r($tester->project->getTotalTaskByProject($projectIdList, 'undone')) && p('27') && e('8'); // 获取id为27的项目下激活的task数量 diff --git a/test/model/project/gettreemenu.php b/test/model/project/gettreemenu.php new file mode 100644 index 0000000000..0c995025b6 --- /dev/null +++ b/test/model/project/gettreemenu.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getTreeMenu(); +cid=1 +pid=1 + +*/ + +global $tester; +$tester->loadModel('project'); + +$lastMenu = $tester->project->getTreeMenu(0, array('projectmodel', 'createManageLink')); + +r(strlen($lastMenu)) && p() && e('1596'); // 查看获取到的menu option的字符串数量 diff --git a/test/model/project/getworkhour.php b/test/model/project/getworkhour.php index 4afdd17e5e..cf6f8da7cf 100755 --- a/test/model/project/getworkhour.php +++ b/test/model/project/getworkhour.php @@ -1,7 +1,7 @@ #!/usr/bin/env php loadModel('project'); -r($project->getWorkHour(13)) && p('totalEstimate') && e('61.0'); //预计61.0小时 -r($project->getWorkHour(13)) && p('totalConsumed') && e('95.0'); //消耗95.0小时 -r($project->getWorkHour(1000)) && p('totalEstimate') && e(''); //测试不存在的项目 \ No newline at end of file +r($tester->project->getWorkHour(13)) && p('totalEstimate') && e('61.0'); //获取项目ID为13的预计工时,61.0小时 +r($tester->project->getWorkHour(13)) && p('totalConsumed') && e('95.0'); //获取项目ID为13的消耗工时,95.0小时 +r($tester->project->getWorkHour(1000)) && p('totalEstimate') && e(''); //测试不存在的项目 diff --git a/test/model/project/isclickable.php b/test/model/project/isclickable.php index f1ceff7bf8..a208b0f4b1 100755 --- a/test/model/project/isclickable.php +++ b/test/model/project/isclickable.php @@ -1,6 +1,7 @@ #!/usr/bin/env php getByID(11); $doingProject = $projectModel->getByID(13); $suspendProject = $projectModel->getByID(17); $closedProject = $projectModel->getByID(18); -$status = array('start', 'finish', 'close', 'suspend', 'activate', ); +$status = array('start', 'finish', 'close', 'suspend', 'activate', ); r($projectModel->isClickable($waitProject, $status[0])) && p() && e('1'); // 检查未开始项目的开始按钮 r($projectModel->isClickable($waitProject, $status[1])) && p() && e('1'); // 检查未开始项目的完成按钮 @@ -58,4 +59,4 @@ r($projectModel->isClickable($closedProject, $status[0])) && p() && e('0'); // r($projectModel->isClickable($closedProject, $status[1])) && p() && e('0'); // 检查已关闭项目的完成按钮 r($projectModel->isClickable($closedProject, $status[2])) && p() && e('0'); // 检查已关闭项目的关闭按钮 r($projectModel->isClickable($closedProject, $status[3])) && p() && e('0'); // 检查已关闭项目的暂停按钮 -r($projectModel->isClickable($closedProject, $status[4])) && p() && e('1'); // 检查已关闭项目的激活按钮 \ No newline at end of file +r($projectModel->isClickable($closedProject, $status[4])) && p() && e('1'); // 检查已关闭项目的激活按钮 diff --git a/test/model/project/savestate.php b/test/model/project/savestate.php index 0d6f754791..86c8b78762 100755 --- a/test/model/project/savestate.php +++ b/test/model/project/savestate.php @@ -9,14 +9,8 @@ title=测试 programModel::saveState; cid=1 pid=1 -传入存在ID的值14,保存session,返回对应值14 >> 14 -传入存在ID的值99,保存session,返回第一位默认值11 >> 11 - */ -$project = new Project('dev1'); +$project = new Project(); -$projectId = array(14, 99); - -r($project->saveState($projectId[0])) && p() && e('14'); //传入存在ID的值14,保存session,返回对应值14 -r($project->saveState($projectId[1])) && p() && e('11'); //传入存在ID的值99,保存session,返回第一位默认值11 \ No newline at end of file +r($project->saveState(99)) && p() && e('11'); //传入存在ID的值99,保存session,返回第一位默认值11 From f654344656c646370d22ddb539428b10330847a8 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 6 Apr 2022 16:14:13 +0800 Subject: [PATCH 33/39] * Modify api param. --- api/v1/entries/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index bd32975f52..d387d95f6d 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -68,7 +68,7 @@ class productEntry extends Entry $product->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->product); break; case 'lastexecution': - $execution = $this->dao->select('t2.id,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $execution = $this->dao->select('t2.id,t2.name,t2.type')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->where('t2.deleted')->eq(0) ->andWhere('t1.product')->eq($productID) From 790932d79d8c730375e9ad581773ba79a3e1c3b2 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 6 Apr 2022 08:43:29 +0000 Subject: [PATCH 34/39] * Fix bug#20909 --- module/project/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/model.php b/module/project/model.php index 3fbca9bb4f..a2528d8578 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -120,7 +120,7 @@ class projectModel extends model if(defined('TUTORIAL')) return $projectID; if($projectID == 0 and $this->cookie->lastProject) $projectID = $this->cookie->lastProject; - if(($projectID == 0 and (int)$this->session->project == 0) or !isset($projects[$projectID])) $projectID = key($projects); + if($projectID == 0 and (int)$this->session->project == 0) $projectID = key($projects); if($projectID == 0) $projectID = key($projects); $this->session->set('project', (int)$projectID, $this->app->tab); From 37f76d050fe165f41c76d436f57d96000d845aab Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Wed, 6 Apr 2022 16:45:30 +0800 Subject: [PATCH 35/39] * Fix bug #18545. --- module/my/view/bug.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index 22af12fe81..c347928130 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -111,7 +111,7 @@ ' title='bug->confirmedList, $bug->confirmed);?>'>bug->confirmedList, $bug->confirmed)?> createLink('bug', 'view', "bugID=$bug->id"), $bug->title, null, "style='color: $bug->color' title='{$bug->title}'");?> - case) echo html::a(helper::createLink('testcase', 'view', "caseID=$bug->case&version=$bug->caseVersion"), "[" . $this->lang->testcase->common . "#$bug->case]", '', "class='bug' title='$bug->case'");?> + case) echo html::a(helper::createLink('testcase', 'view', "caseID=$bug->case&version=$bug->caseVersion"), "[" . $this->lang->testcase->common . "#$bug->case]", '', "class='bug' title='$bug->case'");?> productLink == 'product-all' ? '' : "productID=$bug->product";?> From 09fa1197f6b50c314db6bca01a408c90f430cb06 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 16:59:00 +0800 Subject: [PATCH 36/39] * Fix bug#20278. --- module/bug/model.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/bug/model.php b/module/bug/model.php index 1545d90f87..e2f6587558 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2665,7 +2665,14 @@ class bugModel extends model $bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery) ->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi() ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() - ->beginIF($projectID)->andWhere('project')->eq($projectID)->fi() + + ->beginIF($projectID) + ->andWhere('project', true)->eq($projectID) + ->orWhere('project')->eq(0) + ->andWhere('openedBuild')->eq('trunk') + ->markRight(1) + ->fi() + ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); return $bugs; From a13a3214b54ff3b37172f623f94da0c71e08103a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 6 Apr 2022 17:01:25 +0800 Subject: [PATCH 37/39] * Add project test. --- test/model/project/create.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/model/project/create.php b/test/model/project/create.php index 0f814dde31..2f8d17048d 100644 --- a/test/model/project/create.php +++ b/test/model/project/create.php @@ -19,6 +19,8 @@ pid=1 */ +global $tester; +$tester->app->loadConfig('execution'); $project = new Project(); $data = array( @@ -26,7 +28,7 @@ $data = array( 'name' => '测试新增项目一', 'budget' => '', 'budgetUnit' => 'CNY', - 'begin' => '2022-02-03', + 'begin' => '2022-02-07', 'end' => '2022-03-01', 'desc' => '测试项目描述', 'acl' => 'private', From 22a74fe4bcfad9149b4bff476e98602235d150f3 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 17:09:08 +0800 Subject: [PATCH 38/39] * Modify review code. --- module/testreport/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/testreport/model.php b/module/testreport/model.php index cc9f765121..300a932aaa 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -578,16 +578,16 @@ class testreportModel extends model * Get pairs. * * @param int $productID - * @param int $includedID + * @param int $appendID * @access public * @return array */ - public function getPairs($productID = 0, $includedID = 0) + public function getPairs($productID = 0, $appendID = 0) { return $this->dao->select('id,title')->from(TABLE_TESTREPORT) ->where('deleted')->eq(0) ->beginIF($productID)->andWhere('product')->eq($productID)->fi() - ->beginIF($includedID)->orWhere('id')->eq($includedID)->fi() + ->beginIF($appendID)->orWhere('id')->eq($appendID)->fi() ->orderBy('id_desc') ->fetchPairs(); } From 8d877ea73179364ad9c3a4b0b5292b291d1987a1 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 6 Apr 2022 17:21:02 +0800 Subject: [PATCH 39/39] * Fix bug#18689. --- module/my/lang/en.php | 2 +- module/my/lang/zh-cn.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/my/lang/en.php b/module/my/lang/en.php index b42080077c..4705823a20 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -115,7 +115,7 @@ $lang->my->executionLinkList = array(); if($config->systemMode == 'new') { $lang->my->executionLinkList['execution-all'] = 'Enter the execution list by default, you can view all executions'; - $lang->my->executionLinkList['execution-task'] = 'By default, enter the list of the most recently executed task or kanban view, and you can view the task information under the current iteration'; + $lang->my->executionLinkList['execution-task'] = 'By default, enter the list of the most recently executed task, and you can view the task information under the current iteration'; $lang->my->executionLinkList['execution-executionkanban'] = 'By default, you can enter the execution Kanban to view the execution status of projects in progress'; } if($config->systemMode == 'classic') $lang->my->executionLinkList['execution-task'] = "By default, enter the list of the most recently {$lang->executionCommon} task, and you can view the task information under the current {$lang->executionCommon}"; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 150fef88c6..93e5ddba0d 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -115,7 +115,7 @@ $lang->my->executionLinkList = array(); if($config->systemMode == 'new') { $lang->my->executionLinkList['execution-all'] = '默认进入执行列表,可以查看所有的执行'; - $lang->my->executionLinkList['execution-task'] = '默认进入最近一个执行的任务列表或看板视图,可以查看当前迭代下的任务信息'; + $lang->my->executionLinkList['execution-task'] = '默认进入最近一个执行的任务列表,可以查看当前迭代下的任务信息'; $lang->my->executionLinkList['execution-executionkanban'] = '默认进入执行看板,可以查看进行中项目的执行情况'; } if($config->systemMode == 'classic') $lang->my->executionLinkList['execution-task'] = "默认进入最近一个{$lang->executionCommon}的任务列表,可以查看当前{$lang->executionCommon}下的任务信息";