diff --git a/module/report/model.php b/module/report/model.php index f868901b5b..c36646f0a1 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -133,12 +133,13 @@ class reportModel extends model } /** + * 获取用户的 bugs。 * Get user bugs. * * @access public - * @return void + * @return array */ - public function getUserBugs() + public function getUserBugs(): array { return $this->dao->select('t1.id, t1.title, t2.account as user, t1.deadline') ->from(TABLE_BUG)->alias('t1') diff --git a/module/report/test/model/getuserbugs.php b/module/report/test/model/getuserbugs.php index ce3df209b4..c0db801417 100755 --- a/module/report/test/model/getuserbugs.php +++ b/module/report/test/model/getuserbugs.php @@ -1,7 +1,12 @@ #!/usr/bin/env php config('bug')->gen('100'); +zdTable('user')->gen(10); + su('admin'); /** @@ -10,10 +15,8 @@ title=测试 reportModel->getUserBugs(); cid=1 pid=1 -获取人员bug数 >> admin:79;dev1:52;test1:77 - */ $report = new reportTest(); -r($report->getUserBugsTest()) && p() && e('admin:79;dev1:52;test1:77'); // 获取人员bug数 \ No newline at end of file +r($report->getUserBugsTest()) && p() && e('admin:29;user1:27;user2:28;'); // 获取人员 bug 数 diff --git a/module/report/test/report.class.php b/module/report/test/report.class.php index 5b0ec00412..5f632ee336 100644 --- a/module/report/test/report.class.php +++ b/module/report/test/report.class.php @@ -224,19 +224,20 @@ class reportTest } /** + * 测试获取用户的 bugs。 * Test get user bugs. * * @access public - * @return string + * @return string|array */ - public function getUserBugsTest() + public function getUserBugsTest(): string|array { $objects = $this->objectModel->getUserBugs(); if(dao::isError()) return dao::getError(); $counts = ''; - foreach($objects as $user => $bugs) $counts .= "$user:" . count($bugs) . ';'; + foreach($objects as $user => $bugs) $counts .= "{$user}:" . count($bugs) . ';'; return $counts; } diff --git a/module/report/test/yaml/bug.yaml b/module/report/test/yaml/bug.yaml new file mode 100644 index 0000000000..5149b0c93a --- /dev/null +++ b/module/report/test/yaml/bug.yaml @@ -0,0 +1,7 @@ +title: bug. +desc: bug data. +author: Mengyi Liu +version: "1.0" +fields: + - field: assignedTo + range: admin,user1,user2