diff --git a/test/class/custom.class.php b/test/class/custom.class.php new file mode 100644 index 0000000000..e65e102c82 --- /dev/null +++ b/test/class/custom.class.php @@ -0,0 +1,337 @@ +objectModel = $tester->loadModel('custom'); + } + + /** + * Test get all custom lang. + * + * @access public + * @return int + */ + public function getAllLangTest() + { + $objects = $this->objectModel->getAllLang(); + + if(dao::isError()) return dao::getError(); + $counts = count($objects); + + return $counts; + } + + /** + * Test set value of an item. + * + * @param string $path + * @param string $value + * @access public + * @return object|int + */ + public function setItemTest($path, $value = '') + { + $objects = $this->objectModel->setItem($path, $value); + + if(dao::isError()) return dao::getError(); + + $level = substr_count($path, '.'); + if($level > 1) + { + if($level == 2) list($lang, $module, $key) = explode('.', $path); + if($level == 3) list($lang, $module, $section, $key) = explode('.', $path); + if($level == 4) list($lang, $module, $section, $key, $system) = explode('.', $path); + + global $tester; + $objects = $tester->dao->select('*')->from(TABLE_LANG)->where('`lang`')->eq($lang)->andWhere('`module`')->eq($module)->andWhere('`key`')->eq($key)->fetch(); + } + + return $objects; + } + + /** + * Test get some items + * + * @param string $paramString + * @access public + * @return array + */ + public function getItemsTest($paramString) + { + $objects = $this->objectModel->getItems($paramString); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test delete items. + * + * @param string $paramString + * @access public + * @return int + */ + public function deleteItemsTest($paramString) + { + $objects = $this->objectModel->deleteItems($paramString); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test parse the param string for select or delete items. + * + * @param string $paramString + * @access public + * @return array + */ + public function parseItemParamTest($paramString) + { + $objects = $this->objectModel->parseItemParam($paramString); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test create a DAO object to select or delete one or more records. + * + * @param string $paramString + * @param string $method + * @access public + * @return array|int + */ + public function prepareSQLTest($paramString, $method = 'select') + { + $params = $this->objectModel->parseItemParam($paramString); + if($method == 'delete') + { + $objects = $this->objectModel->prepareSQL($params, $method)->exec(); + } + else + { + $objects = $this->objectModel->prepareSQL($params, $method)->orderBy('lang,id')->fetchAll('key'); + } + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function saveCustomMenuTest($menu, $module, $method = '') + { + $objects = $this->objectModel->saveCustomMenu($menu, $module, $method); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getRequiredFieldsTest($moduleConfig) + { + $objects = $this->objectModel->getRequiredFields($moduleConfig); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get module fields. + * + * @param string $moduleName + * @param string $method + * @access public + * @return array + */ + public function getFormFieldsTest($moduleName, $method = '') + { + global $app; + $app->loadLang($moduleName); + + $objects = $this->objectModel->getFormFields($moduleName, $method); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get UR and SR pairs. + * + * @access public + * @return array + */ + public function getURSRPairsTest() + { + $objects = $this->objectModel->getURSRPairs(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get UR pairs. + * + * @access public + * @return array + */ + public function getURPairsTest() + { + $objects = $this->objectModel->getURPairs(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get SR pairs. + * + * @access public + * @return array + */ + public function getSRPairsTest() + { + $objects = $this->objectModel->getSRPairs(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get UR and SR list. + * + * @access public + * @return array + */ + public function getURSRListTest() + { + $objects = $this->objectModel->getURSRList(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test save required fields. + * + * @param string $moduleName + * @param string $requiredFields + * @param string $fieldsType + * @access public + * @return object + */ + public function saveRequiredFieldsTest($moduleName, $requiredFields, $fieldsType) + { + global $app, $tester; + $app->loadLang($moduleName); + + $_POST = $requiredFields; + $this->objectModel->saveRequiredFields($moduleName); + + $objects = $tester->dao->select('`value`')->from(TABLE_CONFIG) + ->where('`owner`')->eq('system') + ->andWhere('`module`')->eq($moduleName) + ->andWhere('`key`')->eq('requiredFields') + ->andWhere('`section`')->eq($fieldsType) + ->fetch(); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test set product and project and sprint concept. + * + * @param int $sprintConcept + * @access public + * @return object + */ + public function setConceptTest($sprintConcept) + { + global $tester; + + $_POST['sprintConcept'] = $sprintConcept; + $this->objectModel->setConcept(); + + if(dao::isError()) return dao::getError(); + $objects = $tester->dao->select('`id`')->from(TABLE_BLOCK)->where('source')->eq('execution')->fetch(); + + unset($_POST); + + return $objects; + } + + /** + * Test set UR and SR concept. + * + * @param array $SRName + * @access public + * @return int + */ + public function setURAndSRTest($SRName) + { + $_POST = $SRName; + $objects = $this->objectModel->setURAndSR(); + + if(dao::isError()) return dao::getError(); + + unset($_POST); + + return $objects; + } + + /** + * Test edit UR and SR concept. + * + * @param int $key + * @param string $SRName + * @access public + * @return object + */ + public function updateURAndSRTest($key = 0, $SRName) + { + global $app, $tester; + + $_POST['URName'] = '用户需求'; + $_POST['SRName'] = $SRName; + $this->objectModel->updateURAndSR($key); + + if(dao::isError()) return dao::getError(); + + $lang = $app->getClientLang(); + + $objects = $tester->dao->select('`value`')->from(TABLE_LANG) + ->where('`key`')->eq($key) + ->andWhere('section')->eq('URSRList') + ->andWhere('lang')->eq($lang) + ->andWhere('module')->eq('custom') + ->fetch(); + + unset($_POST); + + return $objects; + } + + public function setStoryRequirementTest() + { + $objects = $this->objectModel->setStoryRequirement(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/model/custom/deleteitems.php b/test/model/custom/deleteitems.php new file mode 100755 index 0000000000..a7cc6f8bb3 --- /dev/null +++ b/test/model/custom/deleteitems.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +deleteItems(); +cid=1 +pid=1 + +测试参数为空 >> 0 +测试参数为lang >> 0 +测试参数为lang,module >> 0 +测试参数为lang,key,section >> 0 +测试参数为lang,key,section,module >> 0 +测试参数为lang,key,section,module,vision >> 0 + +*/ + +$lang = 'lang=zh-cn'; +$module = 'module=custom'; +$section = 'section=URSRList'; +$key = 'key=1'; +$vision = 'vision=rnd'; +$paramString = array('', $lang, $lang.'&'.$module, $lang.'&'.$key.'&'.$section, $lang.'&'.$key.'&'.$section.'&'.$module, $lang.'&'.$key.'&'.$section.'&'.$module.'&'.$vision); + +$custom = new customTest(); + +r($custom->deleteItemsTest($paramString[0])) && p() && e('0'); //测试参数为空 +r($custom->deleteItemsTest($paramString[1])) && p() && e('0'); //测试参数为lang +r($custom->deleteItemsTest($paramString[2])) && p() && e('0'); //测试参数为lang,module +r($custom->deleteItemsTest($paramString[3])) && p() && e('0'); //测试参数为lang,key,section +r($custom->deleteItemsTest($paramString[4])) && p() && e('0'); //测试参数为lang,key,section,module +r($custom->deleteItemsTest($paramString[5])) && p() && e('0'); //测试参数为lang,key,section,module,vision +system("./ztest init"); \ No newline at end of file diff --git a/test/model/custom/getalllang.php b/test/model/custom/getalllang.php new file mode 100755 index 0000000000..64c63eb325 --- /dev/null +++ b/test/model/custom/getalllang.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getAllLang(); +cid=1 +pid=1 + +测试正常查询 >> 2 + +*/ + +$custom = new customTest(); + +r($custom->getAllLangTest()) && p() && e('2'); //测试正常查询 \ No newline at end of file diff --git a/test/model/custom/getformfields.php b/test/model/custom/getformfields.php new file mode 100755 index 0000000000..29eeec22bb --- /dev/null +++ b/test/model/custom/getformfields.php @@ -0,0 +1,125 @@ +#!/usr/bin/env php +getFormFields(); +cid=1 +pid=1 + +测试moduleName值为product,method为空 >> 0 +测试moduleName值为product,method为create >> 产品负责人,测试负责人,发布负责人,产品类型 +测试moduleName值为product,method为edit >> 产品负责人,测试负责人,发布负责人,产品类型,状态 +测试moduleName值为story,method为空 >> 0 +测试moduleName值为story,method为create >> 所属模块,所属计划,来源,优先级 +测试moduleName值为story,method为change >> 备注 +测试moduleName值为story,method为close >> 备注 +测试moduleName值为story,method为review >> 评审时间,备注 +测试moduleName值为productplan,method为空 >> 开始日期,结束日期,描述 +测试moduleName值为productplan,method为create >> 开始日期,结束日期,描述 +测试moduleName值为productplan,method为edit >> 开始日期,结束日期,描述 +测试moduleName值为release,method为空 >> 0 +测试moduleName值为release,method为create >> 描述 +测试moduleName值为release,method为edit >> 描述 +测试moduleName值为execution,method为空 >> 0 +测试moduleName值为execution,method为create >> 可用工作日,迭代描述 +测试moduleName值为execution,method为edit >> 可用工作日,迭代描述,产品负责人,迭代负责人 +测试moduleName值为execution,method为close >> 0 +测试moduleName值为execution,method为start >> 0 +测试moduleName值为task,method为空 >> 0 +测试moduleName值为task,method为create >> 相关研发需求,优先级,最初预计,任务描述 +测试moduleName值为task,method为edit >> 优先级,最初预计,预计开始 +测试moduleName值为task,method为finish >> 备注 +测试moduleName值为task,method为activate >> 指派给,备注 +测试moduleName值为build,method为空 >> 源代码地址,下载地址,描述 +测试moduleName值为build,method为create >> 源代码地址,下载地址,描述 +测试moduleName值为build,method为edit >> 源代码地址,下载地址,描述 +测试moduleName值为bug,method为空 >> 0 +测试moduleName值为bug,method为create >> 所属模块,所属项目,截止日期 +测试moduleName值为bug,method为edit >> 所属计划,Bug类型,浏览器,优先级 +测试moduleName值为bug,method为resolve >> 解决版本,备注 +测试moduleName值为testcase,method为空 >> 0 +测试moduleName值为testcase,method为create >> 适用阶段,相关研发需求,优先级 +测试moduleName值为testcase,method为edit >> 适用阶段,相关研发需求,优先级 +测试moduleName值为testsuite,method为空 >> 描述 +测试moduleName值为testsuite,method为create >> 描述 +测试moduleName值为testsuite,method为edit >> 描述 +测试moduleName值为testreport,method为空 >> 开始时间,结束时间,参与人员,总结 +测试moduleName值为testreport,method为create >> 开始时间,结束时间,参与人员,总结 +测试moduleName值为testreport,method为edit >> 开始时间,结束时间,参与人员,总结 +测试moduleName值为caselib,method为空 >> 描述 +测试moduleName值为caselib,method为create >> 描述 +测试moduleName值为caselib,method为edit >> 描述 +测试moduleName值为caselib,method为空 >> 负责人,优先级,描述 +测试moduleName值为testtask,method为create >> 负责人,优先级,描述 +测试moduleName值为testtask,method为edit >> 负责人,优先级,描述 +测试moduleName值为testtask,method为importUnit >> 负责人,优先级,描述 +测试moduleName值为doc,method为空 >> 关键字,文档正文 +测试moduleName值为doc,method为create >> 关键字,文档正文 +测试moduleName值为doc,method为edit >> 关键字,文档正文 +测试moduleName值为user,method为空 >> 0 +测试moduleName值为user,method为create >> 部门,职位,邮箱,源代码帐号 +测试moduleName值为user,method为edit >> Skype,QQ,手机,电话 + +*/ +$moduleName = array('product', 'story', 'productplan', 'release', 'execution', 'task', 'build', 'bug', 'testcase', 'testsuite', 'testreport', 'caselib', 'testtask', 'doc', 'user'); +$method = array('', 'create', 'edit', 'change', 'close', 'review', 'start', 'finish', 'activate', 'resolve', 'importUnit'); + +$custom = new customTest(); + +r($custom->getFormFieldsTest($moduleName[0], $method[0])) && p() && e('0'); //测试moduleName值为product,method为空 +r($custom->getFormFieldsTest($moduleName[0], $method[1])) && p('PO,QD,RD,type') && e('产品负责人,测试负责人,发布负责人,产品类型'); //测试moduleName值为product,method为create +r($custom->getFormFieldsTest($moduleName[0], $method[2])) && p('PO,QD,RD,type,status') && e('产品负责人,测试负责人,发布负责人,产品类型,状态');//测试moduleName值为product,method为edit +r($custom->getFormFieldsTest($moduleName[1], $method[0])) && p() && e('0'); //测试moduleName值为story,method为空 +r($custom->getFormFieldsTest($moduleName[1], $method[1])) && p('module,plan,source,pri') && e('所属模块,所属计划,来源,优先级'); //测试moduleName值为story,method为create +r($custom->getFormFieldsTest($moduleName[1], $method[3])) && p('comment') && e('备注'); //测试moduleName值为story,method为change +r($custom->getFormFieldsTest($moduleName[1], $method[4])) && p('comment') && e('备注'); //测试moduleName值为story,method为close +r($custom->getFormFieldsTest($moduleName[1], $method[5])) && p('reviewedDate,comment') && e('评审时间,备注'); //测试moduleName值为story,method为review +r($custom->getFormFieldsTest($moduleName[2], $method[0])) && p('begin,end,desc') && e('开始日期,结束日期,描述'); //测试moduleName值为productplan,method为空 +r($custom->getFormFieldsTest($moduleName[2], $method[1])) && p('begin,end,desc') && e('开始日期,结束日期,描述'); //测试moduleName值为productplan,method为create +r($custom->getFormFieldsTest($moduleName[2], $method[2])) && p('begin,end,desc') && e('开始日期,结束日期,描述'); //测试moduleName值为productplan,method为edit +r($custom->getFormFieldsTest($moduleName[3], $method[0])) && p() && e('0'); //测试moduleName值为release,method为空 +r($custom->getFormFieldsTest($moduleName[3], $method[1])) && p('desc') && e('描述'); //测试moduleName值为release,method为create +r($custom->getFormFieldsTest($moduleName[3], $method[2])) && p('desc') && e('描述'); //测试moduleName值为release,method为edit +r($custom->getFormFieldsTest($moduleName[4], $method[0])) && p() && e('0'); //测试moduleName值为execution,method为空 +r($custom->getFormFieldsTest($moduleName[4], $method[1])) && p('days,desc') && e('可用工作日,迭代描述'); //测试moduleName值为execution,method为create +r($custom->getFormFieldsTest($moduleName[4], $method[2])) && p('days,desc,PO,PM') && e('可用工作日,迭代描述,产品负责人,迭代负责人'); //测试moduleName值为execution,method为edit +r($custom->getFormFieldsTest($moduleName[4], $method[4])) && p() && e('0'); //测试moduleName值为execution,method为close +r($custom->getFormFieldsTest($moduleName[4], $method[6])) && p() && e('0'); //测试moduleName值为execution,method为start +r($custom->getFormFieldsTest($moduleName[5], $method[0])) && p() && e('0'); //测试moduleName值为task,method为空 +r($custom->getFormFieldsTest($moduleName[5], $method[1])) && p('story,pri,estimate,desc') && e('相关研发需求,优先级,最初预计,任务描述'); //测试moduleName值为task,method为create +r($custom->getFormFieldsTest($moduleName[5], $method[2])) && p('pri,estimate,estStarted') && e('优先级,最初预计,预计开始'); //测试moduleName值为task,method为edit +r($custom->getFormFieldsTest($moduleName[5], $method[7])) && p('comment') && e('备注'); //测试moduleName值为task,method为finish +r($custom->getFormFieldsTest($moduleName[5], $method[8])) && p('assignedTo,comment') && e('指派给,备注'); //测试moduleName值为task,method为activate +r($custom->getFormFieldsTest($moduleName[6], $method[0])) && p('scmPath,filePath,desc') && e('源代码地址,下载地址,描述'); //测试moduleName值为build,method为空 +r($custom->getFormFieldsTest($moduleName[6], $method[1])) && p('scmPath,filePath,desc') && e('源代码地址,下载地址,描述'); //测试moduleName值为build,method为create +r($custom->getFormFieldsTest($moduleName[6], $method[2])) && p('scmPath,filePath,desc') && e('源代码地址,下载地址,描述'); //测试moduleName值为build,method为edit +r($custom->getFormFieldsTest($moduleName[7], $method[0])) && p() && e('0'); //测试moduleName值为bug,method为空 +r($custom->getFormFieldsTest($moduleName[7], $method[1])) && p('module,project,deadline') && e('所属模块,所属项目,截止日期'); //测试moduleName值为bug,method为create +r($custom->getFormFieldsTest($moduleName[7], $method[2])) && p('plan,type,browser,pri') && e('所属计划,Bug类型,浏览器,优先级'); //测试moduleName值为bug,method为edit +r($custom->getFormFieldsTest($moduleName[7], $method[9])) && p('resolvedBuild,comment') && e('解决版本,备注'); //测试moduleName值为bug,method为resolve +r($custom->getFormFieldsTest($moduleName[8], $method[0])) && p() && e('0'); //测试moduleName值为testcase,method为空 +r($custom->getFormFieldsTest($moduleName[8], $method[1])) && p('stage,story,pri') && e('适用阶段,相关研发需求,优先级'); //测试moduleName值为testcase,method为create +r($custom->getFormFieldsTest($moduleName[8], $method[2])) && p('stage,story,pri') && e('适用阶段,相关研发需求,优先级'); //测试moduleName值为testcase,method为edit +r($custom->getFormFieldsTest($moduleName[9], $method[0])) && p('desc') && e('描述'); //测试moduleName值为testsuite,method为空 +r($custom->getFormFieldsTest($moduleName[9], $method[1])) && p('desc') && e('描述'); //测试moduleName值为testsuite,method为create +r($custom->getFormFieldsTest($moduleName[9], $method[2])) && p('desc') && e('描述'); //测试moduleName值为testsuite,method为edit +r($custom->getFormFieldsTest($moduleName[10], $method[0])) && p('begin,end,members,report') && e('开始时间,结束时间,参与人员,总结'); //测试moduleName值为testreport,method为空 +r($custom->getFormFieldsTest($moduleName[10], $method[1])) && p('begin,end,members,report') && e('开始时间,结束时间,参与人员,总结'); //测试moduleName值为testreport,method为create +r($custom->getFormFieldsTest($moduleName[10], $method[2])) && p('begin,end,members,report') && e('开始时间,结束时间,参与人员,总结'); //测试moduleName值为testreport,method为edit +r($custom->getFormFieldsTest($moduleName[11], $method[0])) && p('desc') && e('描述'); //测试moduleName值为caselib,method为空 +r($custom->getFormFieldsTest($moduleName[11], $method[1])) && p('desc') && e('描述'); //测试moduleName值为caselib,method为create +r($custom->getFormFieldsTest($moduleName[11], $method[2])) && p('desc') && e('描述'); //测试moduleName值为caselib,method为edit +r($custom->getFormFieldsTest($moduleName[12], $method[0])) && p('owner,pri,desc') && e('负责人,优先级,描述'); //测试moduleName值为caselib,method为空 +r($custom->getFormFieldsTest($moduleName[12], $method[1])) && p('owner,pri,desc') && e('负责人,优先级,描述'); //测试moduleName值为testtask,method为create +r($custom->getFormFieldsTest($moduleName[12], $method[2])) && p('owner,pri,desc') && e('负责人,优先级,描述'); //测试moduleName值为testtask,method为edit +r($custom->getFormFieldsTest($moduleName[12], $method[10])) && p('owner,pri,desc') && e('负责人,优先级,描述'); //测试moduleName值为testtask,method为importUnit +r($custom->getFormFieldsTest($moduleName[13], $method[0])) && p('keywords,content') && e('关键字,文档正文'); //测试moduleName值为doc,method为空 +r($custom->getFormFieldsTest($moduleName[13], $method[1])) && p('keywords,content') && e('关键字,文档正文'); //测试moduleName值为doc,method为create +r($custom->getFormFieldsTest($moduleName[13], $method[2])) && p('keywords,content') && e('关键字,文档正文'); //测试moduleName值为doc,method为edit +r($custom->getFormFieldsTest($moduleName[14], $method[0])) && p() && e('0'); //测试moduleName值为user,method为空 +r($custom->getFormFieldsTest($moduleName[14], $method[1])) && p('dept,role,email,commiter') && e('部门,职位,邮箱,源代码帐号'); //测试moduleName值为user,method为create +r($custom->getFormFieldsTest($moduleName[14], $method[2])) && p('skype,qq,mobile,phone') && e('Skype,QQ,手机,电话'); //测试moduleName值为user,method为edit \ No newline at end of file diff --git a/test/model/custom/getitems.php b/test/model/custom/getitems.php new file mode 100755 index 0000000000..0099f074e6 --- /dev/null +++ b/test/model/custom/getitems.php @@ -0,0 +1,35 @@ +#!/usr/bin/env php +getItems(); +cid=1 +pid=1 + +测试参数为空 >> zh-cn,custom,URSRList,1,1,rnd +测试参数为lang >> zh-cn,custom,URSRList,1,1,rnd +测试参数为lang,module >> zh-cn,custom,URSRList,1,1,rnd +测试参数为lang,key,section >> zh-cn,custom,URSRList,1,1,rnd +测试参数为lang,key,section,module >> zh-cn,custom,URSRList,1,1,rnd +测试参数为lang,key,section,module,vision >> zh-cn,custom,URSRList,1,1,rnd + +*/ +$lang = 'lang=zh-cn'; +$module = 'module=custom'; +$section = 'section=URSRList'; +$key = 'key=1'; +$vision = 'vision=rnd'; +$paramString = array('', $lang, $lang.'&'.$module, $lang.'&'.$key.'&'.$section, $lang.'&'.$key.'&'.$section.'&'.$module, $lang.'&'.$key.'&'.$section.'&'.$module.'&'.$vision); + +$custom = new customTest(); + +r($custom->getItemsTest($paramString[0])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为空 +r($custom->getItemsTest($paramString[1])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为lang +r($custom->getItemsTest($paramString[2])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为lang,module +r($custom->getItemsTest($paramString[3])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为lang,key,section +r($custom->getItemsTest($paramString[4])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为lang,key,section,module +r($custom->getItemsTest($paramString[5])) && p('1:lang,module,section,key,system,vision') && e('zh-cn,custom,URSRList,1,1,rnd'); //测试参数为lang,key,section,module,vision \ No newline at end of file diff --git a/test/model/custom/getrequiredfields.php b/test/model/custom/getrequiredfields.php new file mode 100755 index 0000000000..634dd5649c --- /dev/null +++ b/test/model/custom/getrequiredfields.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getRequiredFields(); +cid=1 +pid=1 + + + +*/ + +$custom = new customTest(); + +r($custom->getRequiredFieldsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/custom/getsrpairs.php b/test/model/custom/getsrpairs.php new file mode 100755 index 0000000000..5fb2ae0396 --- /dev/null +++ b/test/model/custom/getsrpairs.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getSRPairs(); +cid=1 +pid=1 + +测试正常查询 >> 软件需求,研发需求,软需,故事,需求 + +*/ + +$custom = new customTest(); + +r($custom->getSRPairsTest()) && p('1,2,3,4,5') && e('软件需求,研发需求,软需,故事,需求'); //测试正常查询 \ No newline at end of file diff --git a/test/model/custom/geturpairs.php b/test/model/custom/geturpairs.php new file mode 100755 index 0000000000..953515421e --- /dev/null +++ b/test/model/custom/geturpairs.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getURPairs(); +cid=1 +pid=1 + +测试正常查询 >> 用户需求,用户需求,用需,史诗,用户需求 + +*/ + +$custom = new customTest(); + +r($custom->getURPairsTest()) && p('1,2,3,4,5') && e('用户需求,用户需求,用需,史诗,用户需求'); //测试正常查询 \ No newline at end of file diff --git a/test/model/custom/getursrlist.php b/test/model/custom/getursrlist.php new file mode 100755 index 0000000000..aed23b69cb --- /dev/null +++ b/test/model/custom/getursrlist.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getURSRList(); +cid=1 +pid=1 + +测试正常查询 >> 软件需求,用户需求,1 + +*/ + +$custom = new customTest(); + +r($custom->getURSRListTest()) && p('1:SRName,URName,system') && e('软件需求,用户需求,1'); //测试正常查询 \ No newline at end of file diff --git a/test/model/custom/getursrpairs.php b/test/model/custom/getursrpairs.php new file mode 100755 index 0000000000..14a71e5ab8 --- /dev/null +++ b/test/model/custom/getursrpairs.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getURSRPairs(); +cid=1 +pid=1 + +测试正常查询 >> 软件需求,研发需求,软需,故事,需求 + +*/ + +$custom = new customTest(); + +r($custom->getURSRPairsTest()) && p('1,2,3,4,5') && e('软件需求,研发需求,软需,故事,需求'); //测试正常查询 \ No newline at end of file diff --git a/test/model/custom/parseitemparam.php b/test/model/custom/parseitemparam.php new file mode 100755 index 0000000000..b9f01255da --- /dev/null +++ b/test/model/custom/parseitemparam.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +parseItemParam(); +cid=1 +pid=1 + +测试参数为空 >> ,,,, +测试参数为lang >> zh-cn,,,, +测试参数为lang,module >> zh-cn,custom,,, +测试参数为lang,key,section >> zh-cn,,URSRList,1, +测试参数为lang,key,section,module >> zh-cn,custom,URSRList,1, +测试参数为lang,key,section,module,vision >> zh-cn,custom,URSRList,1,rnd + +*/ + +$lang = 'lang=zh-cn'; +$module = 'module=custom'; +$section = 'section=URSRList'; +$key = 'key=1'; +$vision = 'vision=rnd'; +$paramString = array('', $lang, $lang.'&'.$module, $lang.'&'.$key.'&'.$section, $lang.'&'.$key.'&'.$section.'&'.$module, $lang.'&'.$key.'&'.$section.'&'.$module.'&'.$vision); + +$custom = new customTest(); + +r($custom->parseItemParamTest($paramString[0])) && p('lang,module,section,key,vision') && e(',,,,'); //测试参数为空 +r($custom->parseItemParamTest($paramString[1])) && p('lang,module,section,key,vision') && e('zh-cn,,,,'); //测试参数为lang +r($custom->parseItemParamTest($paramString[2])) && p('lang,module,section,key,vision') && e('zh-cn,custom,,,'); //测试参数为lang,module +r($custom->parseItemParamTest($paramString[3])) && p('lang,module,section,key,vision') && e('zh-cn,,URSRList,1,'); //测试参数为lang,key,section +r($custom->parseItemParamTest($paramString[4])) && p('lang,module,section,key,vision') && e('zh-cn,custom,URSRList,1,'); //测试参数为lang,key,section,module +r($custom->parseItemParamTest($paramString[5])) && p('lang,module,section,key,vision') && e('zh-cn,custom,URSRList,1,rnd'); //测试参数为lang,key,section,module,vision \ No newline at end of file diff --git a/test/model/custom/preparesql.php b/test/model/custom/preparesql.php new file mode 100755 index 0000000000..8e7964c4ee --- /dev/null +++ b/test/model/custom/preparesql.php @@ -0,0 +1,50 @@ +#!/usr/bin/env php +prepareSQL(); +cid=1 +pid=1 + +测试method为select,paramString参数为空 >> zh-cn,custom +测试method为select,paramString参数为lang >> zh-cn,custom +测试method为select,paramString参数为lang,module >> zh-cn,custom +测试method为select,paramString参数为lang,key,section >> zh-cn,custom +测试method为select,paramString参数为lang,key,section,module >> zh-cn,custom +测试method为select,paramString参数为lang,key,section,module,vision >> zh-cn,custom +测试method为delete,paramString参数为空 >> 14 +测试method为delete,paramString参数为lang >> 0 +测试method为delete,paramString参数为lang,module >> 0 +测试method为delete,paramString参数为lang,key,section >> 0 +测试method为delete,paramString参数为lang,key,section,module >> 0 +测试method为delete,paramString参数为lang,key,section,module,vision >> 0 + +*/ + +$lang = 'lang=zh-cn'; +$module = 'module=custom'; +$section = 'section=URSRList'; +$key = 'key=1'; +$vision = 'vision=rnd'; +$paramString = array('', $lang, $lang.'&'.$module, $lang.'&'.$key.'&'.$section, $lang.'&'.$key.'&'.$section.'&'.$module, $lang.'&'.$key.'&'.$section.'&'.$module.'&'.$vision); +$method = array('select', 'delete'); + +$custom = new customTest(); + +r($custom->prepareSQLTest($paramString[0], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为空 +r($custom->prepareSQLTest($paramString[1], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为lang +r($custom->prepareSQLTest($paramString[2], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为lang,module +r($custom->prepareSQLTest($paramString[3], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为lang,key,section +r($custom->prepareSQLTest($paramString[4], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为lang,key,section,module +r($custom->prepareSQLTest($paramString[5], $method[0])) && p('1:lang,module') && e('zh-cn,custom'); //测试method为select,paramString参数为lang,key,section,module,vision +r($custom->prepareSQLTest($paramString[0], $method[1])) && p() && e('14'); //测试method为delete,paramString参数为空 +r($custom->prepareSQLTest($paramString[1], $method[1])) && p() && e('0'); //测试method为delete,paramString参数为lang +r($custom->prepareSQLTest($paramString[2], $method[1])) && p() && e('0'); //测试method为delete,paramString参数为lang,module +r($custom->prepareSQLTest($paramString[3], $method[1])) && p() && e('0'); //测试method为delete,paramString参数为lang,key,section +r($custom->prepareSQLTest($paramString[4], $method[1])) && p() && e('0'); //测试method为delete,paramString参数为lang,key,section,module +r($custom->prepareSQLTest($paramString[5], $method[1])) && p() && e('0'); //测试method为delete,paramString参数为lang,key,section,module,vision +system("./ztest init"); \ No newline at end of file diff --git a/test/model/custom/savecustommenu.php b/test/model/custom/savecustommenu.php new file mode 100755 index 0000000000..347a96cce1 --- /dev/null +++ b/test/model/custom/savecustommenu.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +saveCustomMenu(); +cid=1 +pid=1 + + + +*/ + +$custom = new customTest(); + +r($custom->saveCustomMenuTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/custom/saverequiredfields.php b/test/model/custom/saverequiredfields.php new file mode 100755 index 0000000000..d52f33a695 --- /dev/null +++ b/test/model/custom/saverequiredfields.php @@ -0,0 +1,149 @@ +#!/usr/bin/env php +saveRequiredFields(); +cid=1 +pid=1 + +测试moduleName为product,requiredFields为空 >> name,code +测试moduleName为product,requiredFields中的create存在一个值 >> PO,name,code +测试moduleName为product,requiredFields中的create存在多个值 >> PO,RD,name,code +测试moduleName为product,requiredFields中的edit存在一个值 >> PO,name,code +测试moduleName为product,requiredFields中的edit存在多个值 >> PO,RD,name,code +测试moduleName为product,requiredFields中的create,edit各存在多个值 >> PO,RD,name,code +测试moduleName为release,requiredFields为空 >> name,date +测试moduleName为release,requiredFields中的create存在一个值 >> desc,name,date +测试moduleName为release,requiredFields中的rdit存在一个值 >> desc,name,date +测试moduleName为release,requiredFields中的create,edit各存在一个值 >> desc,name,date +测试moduleName为execution,requiredFields为空 >> name,code,begin,end +测试moduleName为execution,requiredFields中的create存在一个值 >> desc,name,code,begin,end +测试moduleName为execution,requiredFields中的create存在多个值 >> desc,days,name,code,begin,end +测试moduleName为execution,requiredFields中的edit存在一个值 >> desc,name,code,begin,end +测试moduleName为execution,requiredFields中的edit存在多个值 >> desc,days,name,code,begin,end +测试moduleName为execution,requiredFields中的create,edit各存在多个值 >> desc,days,name,code,begin,end +测试moduleName为task,requiredFields为空 >> execution,name,type +测试moduleName为task,requiredFields中的create存在一个值 >> story,execution,name,type +测试moduleName为task,requiredFields中的create存在多个值 >> story,desc,execution,name,type +测试moduleName为task,requiredFields中的edit存在一个值 >> pri,execution,name,type +测试moduleName为task,requiredFields中的edit存在多个值 >> pri,estimate,execution,name,type +测试moduleName为task,requiredFields中的activate存在一个值 >> comment,left +测试moduleName为task,requiredFields中的activate存在多个值 >> comment,assignedTo,left +测试moduleName为task,requiredFields中的create,edit各存在一个值 >> story,execution,name,type +测试moduleName为task,requiredFields中的create,edit,finsh各存在一个值 >> story,execution,name,type +测试moduleName为task,requiredFields中的create,edit,finsh,activate各存在一个值 >> story,execution,name,type +测试moduleName为bug,requiredFields为空 >> title,openedBuild +测试moduleName为bug,requiredFields中的create存在一个值 >> type,title,openedBuild +测试moduleName为bug,requiredFields中的create存在多个值 >> type,os,title,openedBuild +测试moduleName为bug,requiredFields中的edit存在一个值 >> plan,title,openedBuild +测试moduleName为bug,requiredFields中的edit存在多个值 >> plan,type,title,openedBuild +测试moduleName为bug,requiredFields中的resolve存在一个值 >> comment,resolution +测试moduleName为bug,requiredFields中的resolve存在多个值 >> comment,assignedTo,resolution +测试moduleName为bug,requiredFields中的create,edit各存在一个值 >> type,title,openedBuild +测试moduleName为bug,requiredFields中的create,edit,resolve各存在一个值 >> type,title,openedBuild +测试moduleName为testcase,requiredFields为空 >> title,type +测试moduleName为testcase,requiredFields中的create存在一个值 >> stage,title,type +测试moduleName为testcase,requiredFields中的create存在多个值 >> stage,story,title,type +测试moduleName为testcase,requiredFields中的edit存在一个值 >> stage,title,type +测试moduleName为testcase,requiredFields中的edit存在多个值 >> stage,story,title,type +测试moduleName为testcase,requiredFields中的create,edit各存在多个值 >> stage,story,title,type +测试moduleName为task,requiredFields中的finish存在一个值 >> comment,realStarted,finishedDate,currentConsumed + +*/ +$moduleName = array('product', 'release', 'execution', 'task', 'bug', 'testcase'); +$fieldsType = array('create', 'edit', 'finish', 'activate', 'resolve'); +$requiredFields = array( + 'productFields1' => array(), + 'productFields2' => array('requiredFields' => array('create' => array('PO'))), + 'productFields3' => array('requiredFields' => array('create' => array('PO', 'RD'))), + 'productFields4' => array('requiredFields' => array('edit' => array('PO'))), + 'productFields5' => array('requiredFields' => array('edit' => array('PO', 'RD'))), + 'productFields6' => array('requiredFields' => array('create' => array('PO', 'RD'), 'edit' => array('PO', 'RD'))), + 'releaseFields1' => array(), + 'releaseFields2' => array('requiredFields' => array('create' => array('desc'))), + 'releaseFields3' => array('requiredFields' => array('edit' => array('desc'))), + 'releaseFields4' => array('requiredFields' => array('create' => array('desc'), 'edit' => array('desc'))), + 'executionFields1' => array(), + 'executionFields2' => array('requiredFields' => array('create' => array('desc'))), + 'executionFields3' => array('requiredFields' => array('create' => array('desc', 'days'))), + 'executionFields4' => array('requiredFields' => array('edit' => array('desc'))), + 'executionFields5' => array('requiredFields' => array('edit' => array('desc', 'days'))), + 'executionFields6' => array('requiredFields' => array('create' => array('desc', 'days'), 'edit' => array('desc', 'days'))), + 'taskFields1' => array(), + 'taskFields2' => array('requiredFields' => array('create' => array('story'))), + 'taskFields3' => array('requiredFields' => array('create' => array('story', 'desc'))), + 'taskFields4' => array('requiredFields' => array('edit' => array('pri'))), + 'taskFields5' => array('requiredFields' => array('edit' => array('pri', 'estimate'))), + 'taskFields6' => array('requiredFields' => array('finish' => array('comment'))), + 'taskFields7' => array('requiredFields' => array('activate' => array('comment'))), + 'taskFields8' => array('requiredFields' => array('activate' => array('comment', 'assignedTo'))), + 'taskFields9' => array('requiredFields' => array('create' => array('story'), 'edit' => array('pri'))), + 'taskFields10' => array('requiredFields' => array('create' => array('story'), 'edit' => array('pri'), 'finsh' => array('comment'))), + 'taskFields11' => array('requiredFields' => array('create' => array('story'), 'edit' => array('pri'), 'finsh' => array('comment'), 'activate' => array('comment'))), + 'bugFields1' => array(), + 'bugFields2' => array('requiredFields' => array('create' => array('type'))), + 'bugFields3' => array('requiredFields' => array('create' => array('type', 'os'))), + 'bugFields4' => array('requiredFields' => array('edit' => array('plan'))), + 'bugFields5' => array('requiredFields' => array('edit' => array('plan', 'type'))), + 'bugFields6' => array('requiredFields' => array('resolve' => array('comment'))), + 'bugFields7' => array('requiredFields' => array('resolve' => array('comment', 'assignedTo'))), + 'bugFields8' => array('requiredFields' => array('create' => array('type'), 'edit' => array('plan'))), + 'bugFields9' => array('requiredFields' => array('create' => array('type'), 'edit' => array('plan'), 'resolve' => array('comment'))), + 'testcaseFields1' => array(), + 'testcaseFields2' => array('requiredFields' => array('create' => array('stage'))), + 'testcaseFields3' => array('requiredFields' => array('create' => array('stage', 'story'))), + 'testcaseFields4' => array('requiredFields' => array('edit' => array('stage'))), + 'testcaseFields5' => array('requiredFields' => array('edit' => array('stage', 'story'))), + 'testcaseFields6' => array('requiredFields' => array('create' => array('stage', 'story'), 'edit' => array('stage', 'story'))), +); + +$custom = new customTest(); + +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields1'], $fieldsType[0])) && p('value') && e('name,code'); //测试moduleName为product,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields2'], $fieldsType[0])) && p('value') && e('PO,name,code'); //测试moduleName为product,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields3'], $fieldsType[0])) && p('value') && e('PO,RD,name,code'); //测试moduleName为product,requiredFields中的create存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields4'], $fieldsType[1])) && p('value') && e('PO,name,code'); //测试moduleName为product,requiredFields中的edit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields5'], $fieldsType[1])) && p('value') && e('PO,RD,name,code'); //测试moduleName为product,requiredFields中的edit存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[0], $requiredFields['productFields6'], $fieldsType[0])) && p('value') && e('PO,RD,name,code'); //测试moduleName为product,requiredFields中的create,edit各存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[1], $requiredFields['releaseFields1'], $fieldsType[0])) && p('value') && e('name,date'); //测试moduleName为release,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[1], $requiredFields['releaseFields2'], $fieldsType[0])) && p('value') && e('desc,name,date'); //测试moduleName为release,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[1], $requiredFields['releaseFields3'], $fieldsType[1])) && p('value') && e('desc,name,date'); //测试moduleName为release,requiredFields中的rdit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[1], $requiredFields['releaseFields4'], $fieldsType[0])) && p('value') && e('desc,name,date'); //测试moduleName为release,requiredFields中的create,edit各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields1'], $fieldsType[0])) && p('value') && e('name,code,begin,end'); //测试moduleName为execution,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields2'], $fieldsType[0])) && p('value') && e('desc,name,code,begin,end'); //测试moduleName为execution,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields3'], $fieldsType[0])) && p('value') && e('desc,days,name,code,begin,end'); //测试moduleName为execution,requiredFields中的create存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields4'], $fieldsType[1])) && p('value') && e('desc,name,code,begin,end'); //测试moduleName为execution,requiredFields中的edit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields5'], $fieldsType[1])) && p('value') && e('desc,days,name,code,begin,end'); //测试moduleName为execution,requiredFields中的edit存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[2], $requiredFields['executionFields6'], $fieldsType[0])) && p('value') && e('desc,days,name,code,begin,end'); //测试moduleName为execution,requiredFields中的create,edit各存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields1'], $fieldsType[0])) && p('value') && e('execution,name,type'); //测试moduleName为task,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields2'], $fieldsType[0])) && p('value') && e('story,execution,name,type'); //测试moduleName为task,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields3'], $fieldsType[0])) && p('value') && e('story,desc,execution,name,type'); //测试moduleName为task,requiredFields中的create存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields4'], $fieldsType[1])) && p('value') && e('pri,execution,name,type'); //测试moduleName为task,requiredFields中的edit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields5'], $fieldsType[1])) && p('value') && e('pri,estimate,execution,name,type'); //测试moduleName为task,requiredFields中的edit存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields7'], $fieldsType[3])) && p('value') && e('comment,left'); //测试moduleName为task,requiredFields中的activate存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields8'], $fieldsType[3])) && p('value') && e('comment,assignedTo,left'); //测试moduleName为task,requiredFields中的activate存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields9'], $fieldsType[0])) && p('value') && e('story,execution,name,type'); //测试moduleName为task,requiredFields中的create,edit各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields10'], $fieldsType[0])) && p('value') && e('story,execution,name,type'); //测试moduleName为task,requiredFields中的create,edit,finsh各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields11'], $fieldsType[0])) && p('value') && e('story,execution,name,type'); //测试moduleName为task,requiredFields中的create,edit,finsh,activate各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields1'], $fieldsType[0])) && p('value') && e('title,openedBuild'); //测试moduleName为bug,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields2'], $fieldsType[0])) && p('value') && e('type,title,openedBuild'); //测试moduleName为bug,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields3'], $fieldsType[0])) && p('value') && e('type,os,title,openedBuild'); //测试moduleName为bug,requiredFields中的create存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields4'], $fieldsType[1])) && p('value') && e('plan,title,openedBuild'); //测试moduleName为bug,requiredFields中的edit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields5'], $fieldsType[1])) && p('value') && e('plan,type,title,openedBuild'); //测试moduleName为bug,requiredFields中的edit存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields6'], $fieldsType[4])) && p('value') && e('comment,resolution'); //测试moduleName为bug,requiredFields中的resolve存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields7'], $fieldsType[4])) && p('value') && e('comment,assignedTo,resolution'); //测试moduleName为bug,requiredFields中的resolve存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields8'], $fieldsType[0])) && p('value') && e('type,title,openedBuild'); //测试moduleName为bug,requiredFields中的create,edit各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[4], $requiredFields['bugFields9'], $fieldsType[0])) && p('value') && e('type,title,openedBuild'); //测试moduleName为bug,requiredFields中的create,edit,resolve各存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields1'], $fieldsType[0])) && p('value') && e('title,type'); //测试moduleName为testcase,requiredFields为空 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields2'], $fieldsType[0])) && p('value') && e('stage,title,type'); //测试moduleName为testcase,requiredFields中的create存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields3'], $fieldsType[0])) && p('value') && e('stage,story,title,type'); //测试moduleName为testcase,requiredFields中的create存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields4'], $fieldsType[1])) && p('value') && e('stage,title,type'); //测试moduleName为testcase,requiredFields中的edit存在一个值 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields5'], $fieldsType[1])) && p('value') && e('stage,story,title,type'); //测试moduleName为testcase,requiredFields中的edit存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[5], $requiredFields['testcaseFields6'], $fieldsType[0])) && p('value') && e('stage,story,title,type'); //测试moduleName为testcase,requiredFields中的create,edit各存在多个值 +r($custom->saveRequiredFieldsTest($moduleName[3], $requiredFields['taskFields6'], $fieldsType[2])) && p('value') && e('comment,realStarted,finishedDate,currentConsumed');//测试moduleName为task,requiredFields中的finish存在一个值 + +system('./ztest init'); \ No newline at end of file diff --git a/test/model/custom/setconcept.php b/test/model/custom/setconcept.php new file mode 100755 index 0000000000..6f22e6e75e --- /dev/null +++ b/test/model/custom/setconcept.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +setConcept(); +cid=1 +pid=1 + +测试sprintConcept值为0,编辑为产品 - 项目 >> 45 +测试sprintConcept值为1,编辑为产品 - 迭代 >> 45 +测试sprintConcept值为2,编辑为产品 - 冲刺 >> 45 + +*/ +$sprintConcept = array('0', '1', '2'); + +$custom = new customTest(); + +r($custom->setConceptTest($sprintConcept[0])) && p('id') && e('45'); //测试sprintConcept值为0,编辑为产品 - 项目 +r($custom->setConceptTest($sprintConcept[1])) && p('id') && e('45'); //测试sprintConcept值为1,编辑为产品 - 迭代 +r($custom->setConceptTest($sprintConcept[2])) && p('id') && e('45'); //测试sprintConcept值为2,编辑为产品 - 冲刺 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/custom/setitem.php b/test/model/custom/setitem.php new file mode 100755 index 0000000000..d598e278f8 --- /dev/null +++ b/test/model/custom/setitem.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +setItem(); +cid=1 +pid=1 + +测试path中.出现的个数为0,value正常存在,不能保存 >> 0 +测试path中.出现的个数为1,value正常存在,不能保存 >> 0 +测试path中.出现的个数为2,value正常存在,能保存 >> zh-cn,story,categoryList,功能 +测试path中.出现的个数为2,value为空,能保存 >> zh-cn,story,categoryList, +测试path中.出现的个数为3,value正常存在,能保存 >> zh-cn,story,feature,功能 +测试path中.出现的个数为3,value为空,能保存 >> zh-cn,story,feature, +测试path中.出现的个数为4,value正常存在,能保存 >> zh-cn,story,feature,功能 +测试path中.出现的个数为5,value为空,能保存 >> zh-cn,story,feature, + +*/ +$path = array('zh-cn', 'zh-cn.story', 'zh-cn.story.categoryList', 'zh-cn.story.categoryList.feature', 'zh-cn.story.categoryList.feature.1'); +$value = array('功能', ''); + +$custom = new customTest(); + +r($custom->setItemTest($path[0], $value[0])) && p() && e('0'); //测试path中.出现的个数为0,value正常存在,不能保存 +r($custom->setItemTest($path[1], $value[0])) && p() && e('0'); //测试path中.出现的个数为1,value正常存在,不能保存 +r($custom->setItemTest($path[2], $value[0])) && p('lang,module,key,value') && e('zh-cn,story,categoryList,功能'); //测试path中.出现的个数为2,value正常存在,能保存 +r($custom->setItemTest($path[2], $value[1])) && p('lang,module,key,value') && e('zh-cn,story,categoryList,'); //测试path中.出现的个数为2,value为空,能保存 +r($custom->setItemTest($path[3], $value[0])) && p('lang,module,key,value') && e('zh-cn,story,feature,功能'); //测试path中.出现的个数为3,value正常存在,能保存 +r($custom->setItemTest($path[3], $value[1])) && p('lang,module,key,value') && e('zh-cn,story,feature,'); //测试path中.出现的个数为3,value为空,能保存 +r($custom->setItemTest($path[4], $value[0])) && p('lang,module,key,value') && e('zh-cn,story,feature,功能'); //测试path中.出现的个数为4,value正常存在,能保存 +r($custom->setItemTest($path[4], $value[1])) && p('lang,module,key,value') && e('zh-cn,story,feature,'); //测试path中.出现的个数为5,value为空,能保存 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/custom/setstoryrequirement.php b/test/model/custom/setstoryrequirement.php new file mode 100755 index 0000000000..93930aaffc --- /dev/null +++ b/test/model/custom/setstoryrequirement.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +setStoryRequirement(); +cid=1 +pid=1 + + + +*/ + +$custom = new customTest(); + +r($custom->setStoryRequirementTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/custom/seturandsr.php b/test/model/custom/seturandsr.php new file mode 100755 index 0000000000..6945c0d134 --- /dev/null +++ b/test/model/custom/seturandsr.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +setURAndSR(); +cid=1 +pid=1 + +测试SRName值为空 >> 1 +测试SRName值有一个 >> 1 +测试SRName值有多个 >> 1 + +*/ +$SRName = array( + '0' => array('SRName' => array('')), + '1' => array('SRName' => array('测试需求')), + '2' => array('SRName' => array('测试需求', '用户需求')) +); + +$custom = new customTest(); + +r($custom->setURAndSRTest($SRName[0])) && p() && e('1'); //测试SRName值为空 +r($custom->setURAndSRTest($SRName[1])) && p() && e('1'); //测试SRName值有一个 +r($custom->setURAndSRTest($SRName[2])) && p() && e('1'); //测试SRName值有多个 +system("./ztest init"); \ No newline at end of file diff --git a/test/model/custom/updateurandsr.php b/test/model/custom/updateurandsr.php new file mode 100755 index 0000000000..10f975e9f2 --- /dev/null +++ b/test/model/custom/updateurandsr.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +updateURAndSR(); +cid=1 +pid=1 + +测试修改key为1,SRName值更改为空 >> {"SRName":"\u8f6f\u4ef6\u9700\u6c42","URName":"\u7528\u6237\u9700\u6c42"} +测试修改key为1,SRName值更改为软件需求 >> {"SRName":"\u8f6f\u4ef6\u9700\u6c42","URName":"\u7528\u6237\u9700\u6c42"} +测试修改key为1,SRName值更改为软件需求1 >> {"SRName":"\u8f6f\u4ef6\u9700\u6c421","URName":"\u7528\u6237\u9700\u6c42"} +测试修改key为0,SRName值更改为空 >> 0 +测试修改key为0,SRName值更改为软件需求 >> 0 +测试修改key为0,SRName值更改为软件需求1 >> 0 + +*/ +$key = array(1, 0); +$SRName = array('', '软件需求', '软件需求1'); + +$custom = new customTest(); + +r($custom->updateURAndSRTest($key[0], $SRName[0])) && p('value') && e('{"SRName":"\u8f6f\u4ef6\u9700\u6c42","URName":"\u7528\u6237\u9700\u6c42"}'); //测试修改key为1,SRName值更改为空 +r($custom->updateURAndSRTest($key[0], $SRName[1])) && p('value') && e('{"SRName":"\u8f6f\u4ef6\u9700\u6c42","URName":"\u7528\u6237\u9700\u6c42"}'); //测试修改key为1,SRName值更改为软件需求 +r($custom->updateURAndSRTest($key[0], $SRName[2])) && p('value') && e('{"SRName":"\u8f6f\u4ef6\u9700\u6c421","URName":"\u7528\u6237\u9700\u6c42"}'); //测试修改key为1,SRName值更改为软件需求1 +r($custom->updateURAndSRTest($key[1], $SRName[0])) && p() && e('0'); //测试修改key为0,SRName值更改为空 +r($custom->updateURAndSRTest($key[1], $SRName[1])) && p() && e('0'); //测试修改key为0,SRName值更改为软件需求 +r($custom->updateURAndSRTest($key[1], $SRName[2])) && p() && e('0'); //测试修改key为0,SRName值更改为软件需求1 + +system("./ztest init"); \ No newline at end of file