diff --git a/module/story/test/story.class.php b/module/story/test/story.class.php index 8d53fb8290..9c11170141 100644 --- a/module/story/test/story.class.php +++ b/module/story/test/story.class.php @@ -846,4 +846,17 @@ class storyTest $this->objectModel->linkStory($executionID, $productID, $storyID); return $this->objectModel->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->fetchAll(); } + + /** + * 获取一个需求的基础信息。 + * Fetch base info of a story. + * + * @param int $storyID + * @access public + * @return object|bool + */ + public function fetchBaseInfoTest(int $storyID): object|false + { + return $this->objectModel->fetchBaseInfo($storyID); + } } diff --git a/module/story/test/tao/fetchbaseinfo.php b/module/story/test/tao/fetchbaseinfo.php new file mode 100644 index 0000000000..47ec6d68b5 --- /dev/null +++ b/module/story/test/tao/fetchbaseinfo.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +gen(2); + +/** + +title=测试 storyTao->fetchBaseInfo(); +cid=1 +pid=1 + +*/ + +$story = new storyTest(); + +r($story->fetchBaseInfoTest(0)) && p() && e('0'); // storyID 参数为 0 返回 false。 +r($story->fetchBaseInfoTest(3)) && p() && e('0'); // storyID 参数在数据库中不存在返回 false。 +r($story->fetchBaseInfoTest(4)) && p() && e('0'); // storyID 参数在数据库中不存在返回 false。 +r($story->fetchBaseInfoTest(-1)) && p() && e('0'); // storyID 参数小于 mediumint unsigned 类型最小值返回 false。 +r($story->fetchBaseInfoTest(16777216)) && p() && e('0'); // storyID 参数大于 mediumint unsigned 类型最大值返回 false。 + +r($story->fetchBaseInfoTest(1)) && p('id,title,deleted') && e('1,用户需求1,0'); // storyID 参数为 1 返回需求信息。 +r($story->fetchBaseInfoTest(2)) && p('id,title,deleted') && e('2,软件需求2,0'); // storyID 参数为 2 返回需求信息。