* Modify test case.
This commit is contained in:
@@ -4,38 +4,52 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/story.class.php';
|
||||
su('admin');
|
||||
|
||||
$story = zdTable('story');
|
||||
$story->product->range('1');
|
||||
$story->version->range('1');
|
||||
$story->gen(20);
|
||||
|
||||
$storyspec = zdTable('storyspec');
|
||||
$storyspec->version->range('1');
|
||||
$storyspec->gen(12);
|
||||
|
||||
zdTable('product')->gen(1);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 storyModel->batchClose();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
批量关闭6个需求,查看被关闭的需求数量 >> 6
|
||||
批量关闭需求,查看需求1被关闭后的字段 >> closed,closed,done,0
|
||||
批量关闭需求,查看需求2被关闭后的字段 >> closed,closed,willnotdo,0
|
||||
批量关闭需求,查看需求3被关闭后的字段 >> closed,closed,putoff,0
|
||||
批量关闭需求,查看需求4被关闭后的字段 >> closed,closed,duplicate,8
|
||||
批量关闭需求,查看需求5被关闭后的字段 >> closed,closed,cancel,0
|
||||
批量关闭需求,查看需求6被关闭后的字段 >> closed,closed,bydesign,0
|
||||
批量关闭需求,查看需求2被关闭后的字段 >> closed,closed,done,0
|
||||
批量关闭需求,查看需求4被关闭后的字段 >> closed,closed,willnotdo,0
|
||||
批量关闭需求,查看需求6被关闭后的字段 >> closed,closed,putoff,0
|
||||
批量关闭需求,查看需求8被关闭后的字段 >> closed,closed,duplicate,20
|
||||
批量关闭需求,查看需求10被关闭后的字段 >> closed,closed,cancel,0
|
||||
批量关闭需求,查看需求12被关闭后的字段 >> closed,closed,bydesign,0
|
||||
|
||||
*/
|
||||
|
||||
$story = new storyTest();
|
||||
$storyIdList = array(1, 2, 3, 4, 5, 6);
|
||||
$closedReasons = array(1 => 'done', 2 => 'willnotdo', 3 => 'putoff', 4 => 'duplicate', 5 => 'cancel', 6 => 'bydesign');
|
||||
$duplicateList = array(1 => '', 2 => '', 3 => '', 4 => 8, 5 => '', 6 => '');
|
||||
$childStoriesIDList = array(1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '');
|
||||
$storyIdList = array(2, 4, 6, 8, 10, 12);
|
||||
$closedReasons = array(2 => 'done', 4 => 'willnotdo', 6 => 'putoff', 8 => 'duplicate', 10 => 'cancel', 12 => 'bydesign');
|
||||
$duplicateList = array(2 => 0, 4 => 0, 6 => 0, 8 => 20, 10 => 0, 12 => 0);
|
||||
|
||||
$params['storyIdList'] = $storyIdList;
|
||||
$params['closedReasons'] = $closedReasons;
|
||||
$params['duplicateStoryIDList'] = $duplicateList;
|
||||
$params['childStoriesIDList'] = $childStoriesIDList;
|
||||
$stories = $story->batchCloseTest($params);
|
||||
$storiesToClose = array();
|
||||
foreach($storyIdList as $storyID)
|
||||
{
|
||||
$storyToClose = new stdclass();
|
||||
$storyToClose->status = 'closed';
|
||||
$storyToClose->closedReason = $closedReasons[$storyID];
|
||||
$storyToClose->duplicateStory = $duplicateList[$storyID];
|
||||
|
||||
r(count($stories)) && p() && e('6'); // 批量关闭6个需求,查看被关闭的需求数量
|
||||
r($stories) && p('1:status,stage,closedReason,duplicateStory') && e('closed,closed,done,0'); // 批量关闭需求,查看需求1被关闭后的字段
|
||||
r($stories) && p('2:status,stage,closedReason,duplicateStory') && e('closed,closed,willnotdo,0'); // 批量关闭需求,查看需求2被关闭后的字段
|
||||
r($stories) && p('3:status,stage,closedReason,duplicateStory') && e('closed,closed,putoff,0'); // 批量关闭需求,查看需求3被关闭后的字段
|
||||
r($stories) && p('4:status,stage,closedReason,duplicateStory') && e('closed,closed,duplicate,8'); // 批量关闭需求,查看需求4被关闭后的字段
|
||||
r($stories) && p('5:status,stage,closedReason,duplicateStory') && e('closed,closed,cancel,0'); // 批量关闭需求,查看需求5被关闭后的字段
|
||||
r($stories) && p('6:status,stage,closedReason,duplicateStory') && e('closed,closed,bydesign,0'); // 批量关闭需求,查看需求6被关闭后的字段
|
||||
$storiesToClose[$storyID] = $storyToClose;
|
||||
}
|
||||
|
||||
$stories = $story->batchCloseTest($storiesToClose);
|
||||
r($stories) && p('2:status,stage,closedReason,duplicateStory') && e('closed,closed,done,0'); // 批量关闭需求,查看需求1被关闭后的字段
|
||||
r($stories) && p('4:status,stage,closedReason,duplicateStory') && e('closed,closed,willnotdo,0'); // 批量关闭需求,查看需求2被关闭后的字段
|
||||
r($stories) && p('6:status,stage,closedReason,duplicateStory') && e('closed,closed,putoff,0'); // 批量关闭需求,查看需求3被关闭后的字段
|
||||
r($stories) && p('8:status,stage,closedReason,duplicateStory') && e('closed,closed,duplicate,20'); // 批量关闭需求,查看需求4被关闭后的字段
|
||||
r($stories) && p('10:status,stage,closedReason,duplicateStory') && e('closed,closed,cancel,0'); // 批量关闭需求,查看需求5被关闭后的字段
|
||||
r($stories) && p('12:status,stage,closedReason,duplicateStory') && e('closed,closed,bydesign,0'); // 批量关闭需求,查看需求6被关闭后的字段
|
||||
|
||||
@@ -352,21 +352,19 @@ class storyTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch close story.
|
||||
* 测试批量关闭需求。
|
||||
* Test batch close the stories.
|
||||
*
|
||||
* @param array $params
|
||||
* @param array $stories
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function batchCloseTest($params)
|
||||
public function batchCloseTest($stories)
|
||||
{
|
||||
$_POST = $params;
|
||||
$changes = $this->objectModel->batchClose();
|
||||
unset($_POST);
|
||||
|
||||
$this->objectModel->batchClose($stories);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
$storyIdList = array_keys($stories);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user