From 2382519402472c41b5c7b97fe6da83e4805e5dd3 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 19 Sep 2023 13:29:35 +0800 Subject: [PATCH] * testtaskModel: declare the parameter types and return type of the getRuns method. --- module/testtask/model.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index 3f8892e3fa..2bb5f25b03 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1013,26 +1013,28 @@ class testtaskModel extends model } /** - * Get test runs of a test task. + * 获取一个测试单关联的测试用例及相关需求。 + * Get cases associated with a testtask. * * @param int $taskID * @param int $moduleID + * @param string $orderBy * @param object $pager * @access public * @return array */ - public function getRuns($taskID, $moduleID, $orderBy, $pager = null) + public function getRuns(int $taskID, int $moduleID, string $orderBy, object $pager = null): array { /* Select the table for these special fields. */ $specialFields = ',assignedTo,status,lastRunResult,lastRunner,lastRunDate,'; $fieldToSort = substr($orderBy, 0, strpos($orderBy, '_')); $orderBy = strpos($specialFields, ',' . $fieldToSort . ',') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy); - return $this->dao->select('t2.*,t1.*,t2.version as caseVersion,t3.title as storyTitle,t2.status as caseStatus')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*, t1.*, t2.version AS caseVersion, t3.title AS storyTitle, t2.status AS caseStatus')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') - ->where('t1.task')->eq((int)$taskID) - ->andWhere('t2.deleted')->eq(0) + ->where('t1.task')->eq($taskID) + ->andWhere('t2.deleted')->eq('0') ->beginIF($moduleID)->andWhere('t2.module')->in($moduleID)->fi() ->orderBy($orderBy) ->page($pager)