diff --git a/test/class/execution.class.php b/test/class/execution.class.php index 1e98fa3d1e..0079abaa28 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -2390,4 +2390,22 @@ class executionTest return $result > 0; } + + /** + * Test set menu. + * + * @param int $executionID + * @access public + * @return string + */ + public function setMenuTest($executionID = 0) + { + $execution = $this->objectModel->getByID($executionID); + if(empty($execution)) return '0'; + + $this->objectModel->setMenu($executionID); + + global $lang; + return strip_tags($lang->switcherMenu); + } } diff --git a/test/model/execution/setmenu.php b/test/model/execution/setmenu.php new file mode 100644 index 0000000000..e1c5c6733d --- /dev/null +++ b/test/model/execution/setmenu.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +$execution = zdTable('project'); +$execution->id->range('1-5'); +$execution->name->range('项目集1,项目1,迭代1,阶段1,看板1'); +$execution->type->range('execution,project,sprint,stage,kanban'); +$execution->parent->range('0,1,2{3}'); +$execution->status->range('wait{3},suspended,closed,doing'); +$execution->openedBy->range('admin,user1'); +$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); +$execution->gen(5); + +/** + +title=测试 executionModel::setMenu(); +cid=1 +pid=1 + +执行存在的情况 >> 迭代1 +执行不存在的情况 >> 0 + +*/ + +$executionTester = new executionTest(); + +r($executionTester->setMenuTest(3)) && p() && e('迭代1'); // 执行存在的情况 +r($executionTester->setMenuTest(10)) && p() && e('0'); // 执行不存在的情况