From 85d8d10ad19493858b7471d5d0e2d218eb488f96 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Mon, 8 Jul 2024 06:36:15 +0000 Subject: [PATCH] * [unittest] fix unit test. --- module/story/test/tao/buildtrackitems.php | 7 ++++--- module/story/test/tao/buildtracklanes.php | 6 +++--- module/story/test/tao/dochangeparent.php | 11 +++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) mode change 100644 => 100755 module/story/test/tao/buildtrackitems.php mode change 100644 => 100755 module/story/test/tao/buildtracklanes.php diff --git a/module/story/test/tao/buildtrackitems.php b/module/story/test/tao/buildtrackitems.php old mode 100644 new mode 100755 index 02a163a358..f033e30e6d --- a/module/story/test/tao/buildtrackitems.php +++ b/module/story/test/tao/buildtrackitems.php @@ -4,6 +4,7 @@ /** title=测试 storyModel->buildTrackItems(); +timeout=0 cid=0 - 执行$epicItems['lane_11']['epic_1'][0]属性id @11 @@ -99,7 +100,7 @@ r((array)$epicItems['lane_4']['case'][0]) && p('id') && e('4'); $allStoryIdList = array(2,3,4,5,6,7,8,9,10); $stories = $tester->story->dao->select('*')->from(TABLE_STORY)->where('id')->in('2,3,4')->orderBy('id_desc')->fetchAll('id'); -$leafNodes = $tester->story->getLeafNodes($stories, $allStoryIdList); +$leafNodes = $tester->story->getLeafNodes($stories, 'epic'); $allStories = $tester->story->dao->select('id,parent,isParent,root,path,grade,product,pri,type,status,stage,title,estimate')->from(TABLE_STORY)->where('root')->in('1')->andWhere('deleted')->eq(0)->orderBy('type,grade,parent')->fetchAll('id'); $requirementItems = $tester->story->buildTrackItems($allStories, $leafNodes, 'requirement'); @@ -111,7 +112,7 @@ r((array)$epicItems['lane_4']['case'][0]) && p('id') && e('4'); $allStoryIdList = array(5,6,7,8,9,10); $stories = $tester->story->dao->select('*')->from(TABLE_STORY)->where('id')->in('5,6,7,8,9,10')->orderBy('id_desc')->fetchAll('id'); -$leafNodes = $tester->story->getLeafNodes($stories, $allStoryIdList); +$leafNodes = $tester->story->getLeafNodes($stories, 'epic'); $allStories = $tester->story->dao->select('id,parent,isParent,root,path,grade,product,pri,type,status,stage,title,estimate')->from(TABLE_STORY)->where('root')->in('1')->andWhere('deleted')->eq(0)->orderBy('type,grade,parent')->fetchAll('id'); $storyItems = $tester->story->buildTrackItems($allStories, $leafNodes, 'story'); @@ -119,4 +120,4 @@ r((array)$epicItems['lane_10']['requirement_2'][0]) && p('id') && e('3'); r((array)$epicItems['lane_10']['project'][0]) && p('id') && e('1'); r((array)$epicItems['lane_5']['task'][0]) && p('id') && e('5'); r((array)$epicItems['lane_5']['bug'][0]) && p('id') && e('5'); -r((array)$epicItems['lane_5']['case'][0]) && p('id') && e('5'); +r((array)$epicItems['lane_5']['case'][0]) && p('id') && e('5'); \ No newline at end of file diff --git a/module/story/test/tao/buildtracklanes.php b/module/story/test/tao/buildtracklanes.php old mode 100644 new mode 100755 index 5a15a2e11e..feda1e6249 --- a/module/story/test/tao/buildtracklanes.php +++ b/module/story/test/tao/buildtracklanes.php @@ -24,8 +24,8 @@ foreach(array(1,2,3,4) as $storyID) $story->id = $storyID; $leafNodes[$storyID] = $story; } -r(count($tester->story->buildTrackLanes(array()))) && p() && e('0'); //传入空参数。 +r(count($tester->story->buildTrackLanes(array(), 'epic'))) && p() && e('0'); //传入空参数。 -$lanes = $tester->story->buildTrackLanes($leafNodes); +$lanes = $tester->story->buildTrackLanes($leafNodes, 'epic'); r(count($lanes)) && p() && e('4'); //检查泳道数。 -r($lanes[0]['name']) && p() && e('lane_1'); //检查第一个泳道的name参数。 +r($lanes[0]['name']) && p() && e('lane_1'); //检查第一个泳道的name参数。 \ No newline at end of file diff --git a/module/story/test/tao/dochangeparent.php b/module/story/test/tao/dochangeparent.php index d444dd9203..81b3673d16 100755 --- a/module/story/test/tao/dochangeparent.php +++ b/module/story/test/tao/dochangeparent.php @@ -4,10 +4,11 @@ /** title=测试 storyModel->doUpdateSpec(); +timeout=0 cid=0 - 执行$storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(2)->fetch()属性parent @0 -- 执行$storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(1)->fetch()属性childStories @4,5 +- 执行$storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(1)->fetch()属性isParent @1 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; @@ -25,12 +26,14 @@ $story->gen(5); global $tester; $storyModel = $tester->loadModel('story'); +$oldStory = $storyModel->fetchByID(2); + $story = new stdclass(); $story->product = 1; $story->parent = 0; -$storyModel->doChangeParent(3, $story, 2); +$storyModel->doChangeParent(3, $story, $oldStory); r($storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(2)->fetch()) && p('parent') && e('0'); $story->parent = 1; -$storyModel->doChangeParent(3, $story, 0); -r($storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(1)->fetch()) && p('isParent') && e('1'); +$storyModel->doChangeParent(3, $story, new stdClass()); +r($storyModel->dao->select('*')->from(TABLE_STORY)->where('id')->eq(1)->fetch()) && p('isParent') && e('1'); \ No newline at end of file