diff --git a/test/class/story.class.php b/test/class/story.class.php index cedcfe87d2..bed623a3ba 100644 --- a/test/class/story.class.php +++ b/test/class/story.class.php @@ -210,26 +210,26 @@ class storyTest if(dao::isError()) return dao::getError(); - global $tester; - return $tester->loadModel('story')->getById($storyID); - } - - public function updateStoryVersionTest($story) - { - $objects = $this->objectModel->updateStoryVersion($story); - - if(dao::isError()) return dao::getError(); - - return $objects; + return $this->objectModel->getById($storyID); } + /** + * Test update story order of plan. + * + * @param int $storyID + * @param string $planIDList + * @param string $oldPlanIDList + * @access public + * @return void + */ public function updateStoryOrderOfPlanTest($storyID, $planIDList = '', $oldPlanIDList = '') { - $objects = $this->objectModel->updateStoryOrderOfPlan($storyID, $planIDList = '', $oldPlanIDList = ''); + $this->objectModel->updateStoryOrderOfPlan($storyID, $planIDList, $oldPlanIDList); if(dao::isError()) return dao::getError(); - return $objects; + global $tester; + return $tester->dao->select('*')->from(TABLE_PLANSTORY)->where('plan')->in($planIDList)->fetchAll(); } public function computeEstimateTest($storyID) @@ -241,13 +241,22 @@ class storyTest return $objects; } - public function batchUpdateTest() + /** + * Test batch update stories. + * + * @access public + * @return void + */ + public function batchUpdateTest($params) { - $objects = $this->objectModel->batchUpdate(); + $_POST = $params; + $allStories = $this->objectModel->batchUpdate(); + unset($_POST); if(dao::isError()) return dao::getError(); - return $objects; + $storyIdList = array_keys($allStories); + return $this->objectModel->getByList($storyIdList); } public function reviewTest($storyID) diff --git a/test/data/storyspec.yaml b/test/data/storyspec.yaml index c0f48a312a..ba6d4ce4c5 100644 --- a/test/data/storyspec.yaml +++ b/test/data/storyspec.yaml @@ -5,14 +5,14 @@ version: "1.0" fields: - field: story note: "需求ID" - range: 1-20 + range: 1-30 prefix: "" postfix: "" loop: 0 format: "" - field: version note: "版本" - range: 1{20},2{20},3{20} + range: 1{30},2{30},3{20} prefix: "" postfix: "" loop: 0 diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index 3692bf7150..a03351beda 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -18,7 +18,7 @@ $builder->sprint = array('rows' => 600, 'extends' => array('project', 'ex $builder->story = array('rows' => 400, 'extends' => array('story')); $builder->storymodule = array('rows' => 800, 'extends' => array('module','storymodule')); $builder->storyplan = array('rows' => 400, 'extends' => array('planstory')); -$builder->storyspec = array('rows' => 60, 'extends' => array('storyspec')); +$builder->storyspec = array('rows' => 80, 'extends' => array('storyspec')); $builder->relation = array('rows' => 12, 'extends' => array('relation')); $builder->task = array('rows' => 600, 'extends' => array('task','task')); $builder->taskmore = array('rows' => 300, 'extends' => array('task','moretask')); diff --git a/test/model/story/change.php b/test/model/story/change.php index 355d1c2986..b26bfd786d 100644 --- a/test/model/story/change.php +++ b/test/model/story/change.php @@ -22,13 +22,13 @@ $story2['reviewer'] = array('admin', 'test2'); $story2['title'] = ''; $story3 = $story1; -$story3['reviewer'] = array('admin', 'test2'); +$story3['needNotReview'] = true; -$result1 = $story->changeTest(1, $story1); -$result2 = $story->changeTest(2, $story2); -$result3 = $story->changeTest(3, $story3); +$result1 = $story->changeTest(1, $story1); +$result2 = $story->changeTest(2, $story2); +$result3 = $story->changeTest(26, $story3); r($result1[0]) && p() && e('『由谁评审』不能为空。'); // 不勾选【不需要评审】,不传入由谁评审时的变更,给出提示 r($result2) && p('title:0') && e('『研发需求名称』不能为空。'); // 变更时不填写需求名称,给出提示 -r($result3) && p('status,title,spec,verify,estimate,lastEditedBy') && e('changed,测试需求1变更标题,测试需求1的变更描述,测试需求1的变更验收标准,1,admin'); // 正常变更需求,判断返回的status、title等信息 +r($result3) && p('status,title,spec,verify,estimate,lastEditedBy,version') && e('changed,测试需求1变更标题,测试需求1的变更描述,测试需求1的变更验收标准,1,admin,3'); // 正常变更需求,判断返回的status、title等信息 system("./ztest init"); diff --git a/test/model/story/updatestoryorderofplan.php b/test/model/story/updatestoryorderofplan.php index 76c6cd3bb9..5d671358f8 100644 --- a/test/model/story/updatestoryorderofplan.php +++ b/test/model/story/updatestoryorderofplan.php @@ -12,5 +12,11 @@ pid=1 */ $story = new storyTest(); +$planStories1 = $story->updateStoryOrderOfPlanTest(1, 1); +$planStories2 = $story->updateStoryOrderOfPlanTest(1, 2, 1); -r() && p() && e(); \ No newline at end of file +r($planStories1) && p("0:plan,story,order") && e('1,1,21'); // 把需求1迁移到计划1下,获取更新后的planstory +r(count($planStories1)) && p() && e('4'); // 把需求1迁移到计划1下,获取更新后的planstory数量 +r($planStories2) && p("0:plan,story,order") && e('2,1,1'); // 把需求1迁移到计划2下,获取更新后的planstory +r(count($planStories2)) && p() && e('1'); // 把需求1迁移到计划2下,获取更新后的planstory数量 +system("./ztest init");