diff --git a/test/class/my.class.php b/test/class/my.class.php index 6ad6054d93..b9ff6a11d4 100644 --- a/test/class/my.class.php +++ b/test/class/my.class.php @@ -117,16 +117,38 @@ class myTest /** * Get testcases by search. * - * @param int $queryID * @param string $type * @param string $orderBy - * @param int $pager * @access public * @return array */ - public function getTestcasesBySearchTest($queryID, $type, $orderBy, $pager) + public function getTestcasesBySearchTest($type, $orderBy) { + global $tester; + $recTotal = 0; + $recPerPage = 20; + $pageID = 0; + $tester->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + if($type == 'contribute') + { + $cases = $this->dao->select('*')->from(TABLE_CASE)->alias('t1') + ->where($myTestcaseQuery) + ->andWhere('t1.openedBy')->eq($this->app->user->account) + ->andWhere('t1.deleted')->eq(0) + ->orderBy($orderBy)->page($pager)->fetchAll('id'); + } + else + { + $cases = $this->dao->select('t1.*')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case') + ->where($myTestcaseQuery) + ->andWhere('t2.assignedTo')->eq($this->app->user->account) + ->andWhere('t1.deleted')->eq(0) + ->orderBy($orderBy)->page($pager)->fetchAll('id'); + } + return $cases; } /** diff --git a/test/model/my/gettestcasesbysearch.php b/test/model/my/gettestcasesbysearch.php index e69de29bb2..31a0cad711 100755 --- a/test/model/my/gettestcasesbysearch.php +++ b/test/model/my/gettestcasesbysearch.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getTestcasesBySearch(); +cid=1 +pid=1 + +当插入一条action为admin指派了task的动态时,查询结果为1条数据 >> 1 +当插入一条action为admin指派了bug的动态时,查询结果为1条数据 >> 1 + +*/ + +$my = new myTest(); +$type = array('contribute', 'openedbyme'); +$order = 'id_desc'; +a(1111);exit; +r($my->getTestcasesBySearchTest($type[0], $order)) && p() && e('1'); // +r($my->getTestcasesBySearchTest($type[1], $order)) && p() && e('1'); // +