From 7e60f16d2704c86f2ffe475fe2418d799021a07a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 May 2023 16:01:25 +0800 Subject: [PATCH] * Refactor bugModel-getActiveBugs. --- module/bug/control.php | 2 ++ module/bug/model.php | 15 ++++---- module/bug/test/model/getactivebugs.php | 46 ++++++++++--------------- module/bug/test/yaml/execution.yaml | 9 +++++ 4 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 module/bug/test/yaml/execution.yaml diff --git a/module/bug/control.php b/module/bug/control.php index adbc7606ac..02597b47df 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -761,6 +761,8 @@ class bug extends control return $this->send($this->bugZen->responseAfterBatchEdit($toTaskIdList)); } + $_POST['bugIdList'] = array(21826, 21827, 21828); + /* If there is no bug ID, return to the previous step. */ if(!$this->post->bugIdList) $this->locate($this->session->bugList); diff --git a/module/bug/model.php b/module/bug/model.php index 8981977dfb..1e1e044346 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -230,21 +230,22 @@ class bugModel extends model } /** + * 获取激活的未转为bug和任务的 bugs。 * Get active bugs. * - * @param array $products - * @param int $branch - * @param array $executions - * @param array $excludeBugs - * @param object $pager + * @param array|int $products + * @param int|string $branch + * @param string $executions + * @param array $excludeBugs + * @param object $pager * @access public * @return array */ - public function getActiveBugs($products, $branch, $executions, $excludeBugs, $pager = null) + public function getActiveBugs(array|int $products, int|string $branch, string $executions, array $excludeBugs, object $pager = null): array { return $this->dao->select('*')->from(TABLE_BUG) ->where('status')->eq('active') - ->andWhere('tostory')->eq(0) + ->andWhere('toStory')->eq(0) ->andWhere('toTask')->eq(0) ->beginIF(!empty($products))->andWhere('product')->in($products)->fi() ->beginIF($branch !== '' and $branch !== 'all')->andWhere('branch')->in("0,$branch")->fi() diff --git a/module/bug/test/model/getactivebugs.php b/module/bug/test/model/getactivebugs.php index 63dca0287d..e363afdaaf 100755 --- a/module/bug/test/model/getactivebugs.php +++ b/module/bug/test/model/getactivebugs.php @@ -2,6 +2,11 @@ gen(1); +zdTable('bug')->gen(20); +zdTable('product')->gen(10); + su('admin'); /** @@ -10,35 +15,22 @@ title=bugModel->getActiveBugs(); cid=1 pid=1 -查询产品1 2 3 不存在的产品1000001下 且不排除bug的bug >> BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG2,BUG1 -查询产品1 2 3 不存在的产品1000001下 且排除bug2的bug >> BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG1 -查询产品1 2 3 不存在的产品1000001下 且排除bug3 8的bug >> BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG2,BUG1 -查询产品1 3下 且不排除bug的bug >> BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG2,BUG1 -查询产品1 3下 且排除bug2的bug >> BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG1 -查询产品1 3下 且排除bug3 8的bug >> BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG2,BUG1 -查询产品1下 且不排除bug的bug >> BUG3,BUG2,BUG1 -查询产品1下 且排除bug2的bug >> BUG3,BUG1 -查询产品1下 且排除bug3 8的bug >> BUG2,BUG1 -查询不存在的产品1000001下 且不排除bug的bug >> 0 -查询不存在的产品1000001下 且排除bug2的bug >> 0 -查询不存在的产品1000001下 且排除bug3 8的bug >> 0 - */ -$productIDList = array('1,2,3,1000001', '1,3', '1', '1000001'); -$statusList = array('', '2', '3,8'); +$productIDList = array(array(1, 2, 3, 1000001), array(1, 3), 1, 1000001); +$excludeBugs = array(array(), array(2), array(3, 8)); $bug=new bugTest(); -r($bug->getActiveBugsTest($productIDList[0], $statusList[0])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG2,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且不排除bug的bug -r($bug->getActiveBugsTest($productIDList[0], $statusList[1])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且排除bug2的bug -r($bug->getActiveBugsTest($productIDList[0], $statusList[2])) && p() && e('BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG2,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且排除bug3 8的bug -r($bug->getActiveBugsTest($productIDList[1], $statusList[0])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG2,BUG1'); // 查询产品1 3下 且不排除bug的bug -r($bug->getActiveBugsTest($productIDList[1], $statusList[1])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG1'); // 查询产品1 3下 且排除bug2的bug -r($bug->getActiveBugsTest($productIDList[1], $statusList[2])) && p() && e('BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG2,BUG1'); // 查询产品1 3下 且排除bug3 8的bug -r($bug->getActiveBugsTest($productIDList[2], $statusList[0])) && p() && e('BUG3,BUG2,BUG1'); // 查询产品1下 且不排除bug的bug -r($bug->getActiveBugsTest($productIDList[2], $statusList[1])) && p() && e('BUG3,BUG1'); // 查询产品1下 且排除bug2的bug -r($bug->getActiveBugsTest($productIDList[2], $statusList[2])) && p() && e('BUG2,BUG1'); // 查询产品1下 且排除bug3 8的bug -r($bug->getActiveBugsTest($productIDList[3], $statusList[0])) && p() && e('0'); // 查询不存在的产品1000001下 且不排除bug的bug -r($bug->getActiveBugsTest($productIDList[3], $statusList[1])) && p() && e('0'); // 查询不存在的产品1000001下 且排除bug2的bug -r($bug->getActiveBugsTest($productIDList[3], $statusList[2])) && p() && e('0'); // 查询不存在的产品1000001下 且排除bug3 8的bug \ No newline at end of file +r($bug->getActiveBugsTest($productIDList[0], $excludeBugs[0])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG2,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且不排除bug的bug +r($bug->getActiveBugsTest($productIDList[0], $excludeBugs[1])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG3,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且排除bug2的bug +r($bug->getActiveBugsTest($productIDList[0], $excludeBugs[2])) && p() && e('BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG6,BUG5,BUG4,BUG2,BUG1'); // 查询产品1 2 3 不存在的产品1000001下 且排除bug3 8的bug +r($bug->getActiveBugsTest($productIDList[1], $excludeBugs[0])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG2,BUG1'); // 查询产品1 3下 且不排除bug的bug +r($bug->getActiveBugsTest($productIDList[1], $excludeBugs[1])) && p() && e('BUG9,bug8,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG3,BUG1'); // 查询产品1 3下 且排除bug2的bug +r($bug->getActiveBugsTest($productIDList[1], $excludeBugs[2])) && p() && e('BUG9,缺陷!@()(){}|+=%^&*$#测试bug名称到底可以有多长!@#¥%&*":.<>。?/();7,BUG2,BUG1'); // 查询产品1 3下 且排除bug3 8的bug +r($bug->getActiveBugsTest($productIDList[2], $excludeBugs[0])) && p() && e('BUG3,BUG2,BUG1'); // 查询产品1下 且不排除bug的bug +r($bug->getActiveBugsTest($productIDList[2], $excludeBugs[1])) && p() && e('BUG3,BUG1'); // 查询产品1下 且排除bug2的bug +r($bug->getActiveBugsTest($productIDList[2], $excludeBugs[2])) && p() && e('BUG2,BUG1'); // 查询产品1下 且排除bug3 8的bug +r($bug->getActiveBugsTest($productIDList[3], $excludeBugs[0])) && p() && e('0'); // 查询不存在的产品1000001下 且不排除bug的bug +r($bug->getActiveBugsTest($productIDList[3], $excludeBugs[1])) && p() && e('0'); // 查询不存在的产品1000001下 且排除bug2的bug +r($bug->getActiveBugsTest($productIDList[3], $excludeBugs[2])) && p() && e('0'); // 查询不存在的产品1000001下 且排除bug3 8的bug diff --git a/module/bug/test/yaml/execution.yaml b/module/bug/test/yaml/execution.yaml new file mode 100644 index 0000000000..e9d090d55a --- /dev/null +++ b/module/bug/test/yaml/execution.yaml @@ -0,0 +1,9 @@ +--- +title: zt_project +author: Mengyi Liu +version: "1.0" +fields: +- field: type + range: scrum +... +