From 0e6c1e24b3e7b4894c9c2f91147fc78182fb1ec1 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Fri, 13 May 2022 11:17:32 +0800 Subject: [PATCH] * Add the auto test case for action model. --- test/class/action.class.php | 21 +++++++++++++++++++-- test/model/action/gettrashes.php | 17 ++++++++++------- test/model/action/gettrashobjecttypes.php | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 test/model/action/gettrashobjecttypes.php diff --git a/test/class/action.class.php b/test/class/action.class.php index 5bec57c589..7573b0bc59 100644 --- a/test/class/action.class.php +++ b/test/class/action.class.php @@ -131,15 +131,32 @@ class actionTest /** * Test get deleted objects. * + * @param string $objectType * @param string $type * @param string $orderBy * @param object $pager * @access public * @return array */ - public function getTrashesTest($type, $orderBy, $pager) + public function getTrashesTest($objectType, $type, $orderBy, $pager) { - $objects = $this->objectModel->getTrashes($type, $orderBy, $pager); + $objects = $this->objectModel->getTrashes($objectType, $type, $orderBy, $pager); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get object type list of trashes. + * + * @param string $type + * @access public + * @return array + */ + public function getTrashObjectTypesTest($type) + { + $objects = $this->objectModel->getTrashObjectTypes($type); if(dao::isError()) return dao::getError(); diff --git a/test/model/action/gettrashes.php b/test/model/action/gettrashes.php index 29242599b3..c1ca62efd1 100755 --- a/test/model/action/gettrashes.php +++ b/test/model/action/gettrashes.php @@ -17,13 +17,16 @@ pid=1 */ -$typeList = array('all', 'hidden'); -$orderBy = array('id_desc', 'id_asc'); -$pager = null; +$objectTypeList = array('all', 'story', 'testcase'); +$typeList = array('all', 'hidden'); +$orderBy = array('id_desc', 'id_asc'); +$pager = null; $action = new actionTest(); -r($action->getTrashesTest($typeList[0], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('testsuite,,这是测试套件名称87;story,,软件需求48'); // 查询type all id desc排序的回收站信息 -r($action->getTrashesTest($typeList[0], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('story,,软件需求48;testsuite,,这是测试套件名称87'); // 查询type all id desc排序的回收站信息 -r($action->getTrashesTest($typeList[1], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询type hidden id asc排序的回收站信息 -r($action->getTrashesTest($typeList[1], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询type hidden id asc排序的回收站信息 \ No newline at end of file +r($action->getTrashesTest($objectTypeList[0], $typeList[0], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('testsuite,,这是测试套件名称87;story,,软件需求48'); // 查询objectType all type all id desc排序的回收站信息 +r($action->getTrashesTest($objectTypeList[0], $typeList[0], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('story,,软件需求48;testsuite,,这是测试套件名称87'); // 查询objectType all type all id desc排序的回收站信息 +r($action->getTrashesTest($objectTypeList[0], $typeList[1], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType all type hidden id asc排序的回收站信息 +r($action->getTrashesTest($objectTypeList[0], $typeList[1], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType all type hidden id asc排序的回收站信息 +r($action->getTrashesTest($objectTypeList[1], $typeList[0], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('story,,软件需求48'); // 查询objectType story type all id asc排序的回收站信息 +r($action->getTrashesTest($objectTypeList[2], $typeList[1], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType testcase hidden id asc排序的回收站信息 diff --git a/test/model/action/gettrashobjecttypes.php b/test/model/action/gettrashobjecttypes.php new file mode 100644 index 0000000000..59d4982b27 --- /dev/null +++ b/test/model/action/gettrashobjecttypes.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getTrashObjectTypes(); +cid=1 +pid=1 + +*/ + +$typeList = array('all', 'hidden'); + +$action = new actionTest(); + +r($action->getTrashObjectTypesTest($typeList[0])) && p('story:objectType') && e('story'); // 查询type all 的对象类型列表 +r($action->getTrashObjectTypesTest($typeList[1])) && p('testcase:objectType') && e('testcase'); // 查询type all 的对象类型列表