* Compatible unit test, remove unused code.
This commit is contained in:
+2
-28
@@ -1430,13 +1430,12 @@ class storyModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
if(strpos($this->config->story->close->requiredFields, 'comment') !== false and !$this->post->comment) dao::$errors['comment'][] = sprintf($this->lang->error->notempty, $this->lang->comment);
|
||||
if(strpos($this->config->{$oldStory->type}->close->requiredFields, 'comment') !== false and !$this->post->comment) dao::$errors['comment'][] = sprintf($this->lang->error->notempty, $this->lang->comment);
|
||||
|
||||
$this->lang->story->comment = $this->lang->comment;
|
||||
$moduleName = $this->app->rawModule;
|
||||
$this->dao->update(TABLE_STORY)->data($story, 'comment,closeSync')
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->{$moduleName}->close->requiredFields, 'notempty')
|
||||
->batchCheck($this->config->{$oldStory->type}->close->requiredFields, 'notempty')
|
||||
->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty')
|
||||
->checkFlow()
|
||||
->where('id')->eq($storyID)
|
||||
@@ -1445,7 +1444,6 @@ class storyModel extends model
|
||||
|
||||
/* Update parent story status and stage. */
|
||||
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
|
||||
//if($oldStory->isParent == '1') $this->closeAllChildren($storyID, $story->closedReason);
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->setStage($storyID);
|
||||
@@ -1502,7 +1500,6 @@ class storyModel extends model
|
||||
|
||||
/* Update parent story status. */
|
||||
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
|
||||
//if($oldStory->isParent == '1') $this->closeAllChildren($storyID, $story->closedReason);
|
||||
$this->setStage($storyID);
|
||||
|
||||
$changes = common::createChanges($oldStory, $story);
|
||||
@@ -2279,29 +2276,6 @@ class storyModel extends model
|
||||
return $this->formatStories($stories, $type, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭父需求的所有子需求。
|
||||
* Close all children of a story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string closedReason
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function closeAllChildren(int $storyID, string $closedReason)
|
||||
{
|
||||
$childIdList = $this->getAllChildId($storyID, false, true);
|
||||
$this->dao->update(TABLE_STORY)
|
||||
->set('status')->eq('closed')
|
||||
->set('stage')->eq('closed')
|
||||
->set('closedReason')->eq($closedReason)
|
||||
->where('id')->in($childIdList)
|
||||
->exec();
|
||||
|
||||
$this->loadModel('action');
|
||||
foreach($childIdList as $childID) $this->action->create('story', $childID, 'closedbyparent');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需求的所有子需求ID。
|
||||
* Get all child stories of a story.
|
||||
|
||||
@@ -411,6 +411,9 @@ class storyTest
|
||||
*/
|
||||
public function closeTest(int $storyID, object $postData)
|
||||
{
|
||||
global $tester;
|
||||
$tester->loadModel('requirement');
|
||||
$tester->loadModel('epic');
|
||||
$this->objectModel->close($storyID, $postData);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/**
|
||||
|
||||
title=测试 storyModel->close();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 关闭一个用户需求,查看状态
|
||||
@@ -19,7 +20,7 @@ cid=0
|
||||
- 关闭一个重复了的需求,但缺少重复的需求的ID,查看状态
|
||||
- 属性status @~~
|
||||
- 属性closedReason @~~
|
||||
- 属性duplicateStory @『重复研发需求』不能为空。
|
||||
- 属性duplicateStory @『重复需求』不能为空。
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
@@ -58,7 +59,7 @@ $story2 = $story->closeTest(2, $postData2);
|
||||
$story3 = $story->closeTest(3, $postData3);
|
||||
$story4 = $story->closeTest(4, $postData4);
|
||||
|
||||
r($story1) && p('status,closedReason') && e('closed,done'); // 关闭一个用户需求,查看状态
|
||||
r($story2) && p('status,closedReason') && e('closed,willnotdo'); // 关闭一个软件需求,查看状态
|
||||
r($story3) && p('status,closedReason,duplicateStory') && e('closed,duplicate,5'); // 关闭一个重复了的需求,查看状态
|
||||
r($story4) && p('status,closedReason,duplicateStory') && e('~~,~~,『重复研发需求』不能为空。'); // 关闭一个重复了的需求,但缺少重复的需求的ID,查看状态
|
||||
r($story1) && p('status,closedReason') && e('closed,done'); // 关闭一个用户需求,查看状态
|
||||
r($story2) && p('status,closedReason') && e('closed,willnotdo'); // 关闭一个软件需求,查看状态
|
||||
r($story3) && p('status,closedReason,duplicateStory') && e('closed,duplicate,5'); // 关闭一个重复了的需求,查看状态
|
||||
r($story4) && p('status,closedReason,duplicateStory') && e('~~,~~,『重复需求』不能为空。'); // 关闭一个重复了的需求,但缺少重复的需求的ID,查看状态
|
||||
Reference in New Issue
Block a user