Merge branch 'sprint/189_hufangzhou_autotest' into 'master'

* Add the auto test case for action model.

See merge request easycorp/zentaopms!3388
This commit is contained in:
王怡栋
2022-05-13 03:34:22 +00:00
3 changed files with 49 additions and 9 deletions
+19 -2
View File
@@ -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();
+10 -7
View File
@@ -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排序的回收站信息
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排序的回收站信息
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/action.class.php';
su('admin');
/**
title=测试 actionModel->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 的对象类型列表