diff --git a/module/action/tao.php b/module/action/tao.php index 5f23466f55..062931e101 100644 --- a/module/action/tao.php +++ b/module/action/tao.php @@ -88,7 +88,7 @@ class actionTao extends actionModel switch($objectType) { case 'story': - list($product, $project, $execution) = $this->getStoryActionRelated($actionType, $objectID, (int)$extra); + list($product, $project, $execution) = $this->getStoryActionRelated($objectType, $actionType, $objectID, (int)$extra); break; case 'productplan': case 'branch': @@ -139,16 +139,16 @@ class actionTao extends actionModel * 获取用户故事相关的产品、项目、阶段。 * Get story related product, project, stage. * + * @param string $objectType * @param string $actionType * @param int $objectID * @param int $extra * @access public * @return array */ - public function getStoryActionRelated(string $actionType, int $objectID, int $extra): array + public function getStoryActionRelated(string $objectType, string $actionType, int $objectID, int $extra): array { - $product = array(0); - $project = $execution = 0; + list($product, $project, $execution) = $this->getGenerateRelated($objectType, $objectID); switch($actionType) { case 'linked2build': diff --git a/module/action/test/tao/getstoryactionrelated.php b/module/action/test/tao/getstoryactionrelated.php index 2e72c769a9..a10b030434 100755 --- a/module/action/test/tao/getstoryactionrelated.php +++ b/module/action/test/tao/getstoryactionrelated.php @@ -35,13 +35,13 @@ zenData('project')->loadYaml('execution')->gen(1); zenData('project')->gen(11, false, false); zenData('projectstory')->gen(5); -$actionTest = new actionTest(); +global $tester; $actionTypeList = array('linked2build', 'unlinkedfrombuild', 'estimated', 'created'); $objectIDList = array(1, 2); $extraList = array(1, 101); -r($actionTest->getStoryActionRelated($actionTypeList[0], $objectIDList[0], $extraList[0])) && p('0:0;1;2') && e('0,11,101'); //获取操作类型为linked2build,extra为1的用户故事相关产品,项目和执行信息。 -r($actionTest->getStoryActionRelated($actionTypeList[1], $objectIDList[0], $extraList[0])) && p('0:0;1;2') && e('0,11,101'); //获取操作类型为unlinkedfrombuild,extra为1的用户故事相关产品,项目和执行信息。 -r($actionTest->getStoryActionRelated($actionTypeList[2], $objectIDList[0], $extraList[1])) && p('0:0;1;2') && e('0,11,101'); //获取操作类型为estimated,extra为1的用户故事相关产品,项目和执行信息。 -r($actionTest->getStoryActionRelated($actionTypeList[3], $objectIDList[1], $extraList[1])) && p('0:0;1;2') && e('0,11,0'); //获取操作类型为created,extra为1的用户故事相关产品,项目和执行信息。 \ No newline at end of file +r($tester->loadModel('action')->getStoryActionRelated('story', $actionTypeList[0], $objectIDList[0], $extraList[0])) && p('0:0;1;2') && e('1,11,101'); //获取操作类型为linked2build,extra为1的用户故事相关产品,项目和执行信息。 +r($tester->loadModel('action')->getStoryActionRelated('story', $actionTypeList[1], $objectIDList[0], $extraList[0])) && p('0:0;1;2') && e('1,11,101'); //获取操作类型为unlinkedfrombuild,extra为1的用户故事相关产品,项目和执行信息。 +r($tester->loadModel('action')->getStoryActionRelated('story', $actionTypeList[2], $objectIDList[0], $extraList[1])) && p('0:0;1;2') && e('1,11,101'); //获取操作类型为estimated,extra为1的用户故事相关产品,项目和执行信息。 +r($tester->loadModel('action')->getStoryActionRelated('story', $actionTypeList[3], $objectIDList[1], $extraList[1])) && p('0:0;1;2') && e('1,11,0'); //获取操作类型为created,extra为1的用户故事相关产品,项目和执行信息。 \ No newline at end of file