* Add auto test of action.
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/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->buildDateGroup();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$directionList = array('next', 'pre');
|
||||
$typeList = array('today', 'yesterday', 'thisweek', 'lastweek');
|
||||
$orderBy = 'date_asc';
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0])) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1])) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[2])) && p() && e('9'); // 测试创建下一个动作日期组 本周
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[3])) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderBy)) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderBy)) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[2], $orderBy)) && p() && e('9'); // 测试创建下一个动作日期组 本周
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[3], $orderBy)) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0])) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1])) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[2])) && p() && e('9'); // 测试创建下一个动作日期组 本周
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[3])) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/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->computeBeginAndEnd();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$typeList = array('all', 'today', 'yesterday', 'twodaysago', 'latest3days', 'thisweek', 'lastweek', 'thismonth', 'lastmonth');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->computeBeginAndEndTest($typeList[0])) && p() && e('1'); // 测试计算all的日期
|
||||
r($action->computeBeginAndEndTest($typeList[1])) && p() && e('1'); // 测试计算today的日期
|
||||
r($action->computeBeginAndEndTest($typeList[2])) && p() && e('1'); // 测试计算yesterday的日期
|
||||
r($action->computeBeginAndEndTest($typeList[3])) && p() && e('1'); // 测试计算twodaysago的日期
|
||||
r($action->computeBeginAndEndTest($typeList[4])) && p() && e('1'); // 测试计算latest3days的日期
|
||||
r($action->computeBeginAndEndTest($typeList[5])) && p() && e('1'); // 测试计算thisweek的日期
|
||||
r($action->computeBeginAndEndTest($typeList[6])) && p() && e('1'); // 测试计算lastweek的日期
|
||||
r($action->computeBeginAndEndTest($typeList[7])) && p() && e('1'); // 测试计算thismonth的日期
|
||||
r($action->computeBeginAndEndTest($typeList[8])) && p() && e('1'); // 测试计算lastmonth的日期
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/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->getById();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$actionIDList = array('1', '2', '3', '4', '5');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getByIdTest($actionIDList[0])) && p('objectType,objectId,action,comment') && e('product,,common,这是一个系统日志测试备注1'); // 测试获取动态1的信息
|
||||
r($action->getByIdTest($actionIDList[1])) && p('objectType,objectId,action,comment') && e('story,,extra,这是一个系统日志测试备注2'); // 测试获取动态2的信息
|
||||
r($action->getByIdTest($actionIDList[2])) && p('objectType,objectId,action,comment') && e('productplan,,opened,这是一个系统日志测试备注3'); // 测试获取动态3的信息
|
||||
r($action->getByIdTest($actionIDList[3])) && p('objectType,objectId,action,comment') && e('release,,created,这是一个系统日志测试备注4'); // 测试获取动态4的信息
|
||||
r($action->getByIdTest($actionIDList[4])) && p('objectType,objectId,action,comment') && e('project,,changed,这是一个系统日志测试备注5'); // 测试获取动态5的信息
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/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->getBySQL();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$sql1 = "id like '1%'";
|
||||
$sql2 = "objectType = 'product'";
|
||||
$sql3 = "objectID < 10";
|
||||
$sql4 = "action = 'opened'";
|
||||
$sql5 = "`read` = '0'";
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getBySQLTest($sql1)) && p() && e('12'); // 查询id like %1的动作个数
|
||||
r($action->getBySQLTest($sql2)) && p() && e('5'); // 查询objectType = product的动作个数
|
||||
r($action->getBySQLTest($sql3)) && p() && e('9'); // 查询objectID < 10的动作个数
|
||||
r($action->getBySQLTest($sql4)) && p() && e('3'); // 查询action = opend的动作个数
|
||||
r($action->getBySQLTest($sql5)) && p() && e('50'); // 查询read = 0的动作个数
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/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->getDynamic();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$accountList = array('all', 'admin', 'dev17', 'test18');
|
||||
$typeList = array('all', 'today', 'yesterday', 'thisweek', 'lastweek');
|
||||
$productIDList = array('all', 1, 2, 3);
|
||||
$projectIDList = array('all', 1, 2, 3);
|
||||
$executionIDList = array('all', 1, 2, 3);
|
||||
$dateList = array('', 'today');
|
||||
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getDynamicTest()) && p() && e('100'); // 查找全部动态
|
||||
r($action->getDynamicTest($accountList[1])) && p() && e('34'); // 查找用户admin动态
|
||||
r($action->getDynamicTest($accountList[2])) && p() && e('33'); // 查找用户dev17动态
|
||||
r($action->getDynamicTest($accountList[3])) && p() && e('33'); // 查找用户test18动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[1])) && p() && e('3'); // 查找今天的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[2])) && p() && e('3'); // 查找昨天的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[3])) && p() && e('9'); // 查找本周的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[4])) && p() && e('21'); // 查找上周的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[1])) && p() && e('1'); // 查找产品1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[2])) && p() && e('1'); // 查找产品2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[3])) && p() && e('1'); // 查找产品3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[1])) && p() && e('1'); // 查找项目1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[2])) && p() && e('1'); // 查找项目2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[3])) && p() && e('1'); // 查找项目3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[1])) && p() && e('0'); // 查找执行1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[2])) && p() && e('0'); // 查找执行2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[3])) && p() && e('0'); // 查找执行3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[0], $dateList[1])) && p() && e('97'); // 查找今天的动态
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/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->getHistory();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$actionIDList = array('1', '2', '3', '4', '5');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getHistoryTest($actionIDList[0])) && p("0:field,old,new") && e('resolution,1,2'); // 查找actionID为1的历史记录
|
||||
r($action->getHistoryTest($actionIDList[1])) && p("0:field,old,new") && e('resolvedBuild,2,3'); // 查找actionID为2的历史记录
|
||||
r($action->getHistoryTest($actionIDList[2])) && p("0:field,old,new") && e('resolvedDate,2020-01-01,2020-01-17'); // 查找actionID为3的历史记录
|
||||
r($action->getHistoryTest($actionIDList[3])) && p("0:field,old,new") && e('status,doing,done'); // 查找actionID为4的历史记录
|
||||
r($action->getHistoryTest($actionIDList[4])) && p("0:field,old,new") && e('resolution,1,2'); // 查找actionID为5的历史记录
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#!/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->getRelatedDataByActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$actions = array('1,2,3,4,5', '6,7,8,9,10', '11,12,13,14,15', '16,17,18,19,20', '21,22,23,24,25');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'objectNames')) && p('project:5') && e('项目集5'); // 获取动态1 2 3 4 5 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'objectNames')) && p('user:0') && e('guest'); // 获取动态1 2 3 4 5 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'relatedProjects')) && p('project:5') && e('5'); // 获取动态1 2 3 4 5 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'requirements')) && p() && e('0'); // 获取动态1 2 3 4 5 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'objectNames')) && p('case:10') && e('这个是测试用例10'); // 获取动态6 7 8 9 10 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'objectNames')) && p('user:0') && e('guest'); // 获取动态6 7 8 9 10 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'relatedProjects')) && p('case:10') && e('0'); // 获取动态6 7 8 9 10 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'requirements')) && p() && e('0'); // 获取动态6 7 8 9 10 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'objectNames')) && p('todo:15') && e('测试单15的待办'); // 获取动态11 12 13 14 15 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'objectNames')) && p('user:0') && e('guest'); // 获取动态11 12 13 14 15 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'relatedProjects')) && p('doc:13') && e('0'); // 获取动态11 12 13 14 15 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'requirements')) && p() && e('0'); // 获取动态11 12 13 14 15 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'objectNames')) && p('caselib:19') && e('这是测试套件名称19'); // 获取动态16 17 18 19 20 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'objectNames')) && p('user:0') && e('guest'); // 获取动态16 17 18 19 20 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'relatedProjects')) && p('caselib:19') && e('0'); // 获取动态16 17 18 19 20 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'requirements')) && p() && e('0'); // 获取动态16 17 18 19 20 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'objectNames')) && p('story:25') && e('用户需求25'); // 获取动态21 22 23 24 25 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'objectNames')) && p('user:0') && e('guest'); // 获取动态21 22 23 24 25 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'relatedProjects')) && p('story:0') && e(''); // 获取动态21 22 23 24 25 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'requirements')) && p('25') && e('25'); // 获取动态21 22 23 24 25 requirements的关联信息
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/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->getTrashes();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$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排序的回收站信息
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/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->hideAll();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->hideAllTest()) && p('0:extra;1:extra;2:extra') && e('2;2;2'); // 隐藏回收站全部信息
|
||||
system("./ztest init");
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/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->hideOne();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
$actionIDList = array('48', '87', '9', '1');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->hideOneTest($actionIDList[0])) && p('extra') && e('2'); // 隐藏action 28
|
||||
r($action->hideOneTest($actionIDList[1])) && p('extra') && e('2'); // 隐藏action 87
|
||||
r($action->hideOneTest($actionIDList[2])) && p('extra') && e('2'); // 隐藏已隐藏action 9
|
||||
r($action->hideOneTest($actionIDList[3])) && p('extra') && e('1'); // 隐藏非删除action 1
|
||||
system("./ztest init");
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/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->processProjectActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$actions = array('1,2,3,4,5', '26,27,28,29,30', '51,52,53,54,55', '71,72,73,74,75', '96,97,98,99,100', '5,28,51,74,97');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->processProjectActionsTest($actions[0])) && p() && e('5'); // 测试计算action 1 2 3 4 5 的项目动态
|
||||
r($action->processProjectActionsTest($actions[1])) && p() && e('28'); // 测试计算action 26 27 28 29 30 的项目动态
|
||||
r($action->processProjectActionsTest($actions[2])) && p() && e('51'); // 测试计算action 51 52 53 54 55 的项目动态
|
||||
r($action->processProjectActionsTest($actions[3])) && p() && e('74'); // 测试计算action 71 72 73 74 75 的项目动态
|
||||
r($action->processProjectActionsTest($actions[4])) && p() && e('97'); // 测试计算action 96 97 98 99 100 的项目动态
|
||||
r($action->processProjectActionsTest($actions[5])) && p() && e('5,28,51,74,97'); // 测试计算action 5 28 51 74 97 的项目动态
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/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->read();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$objectType = array('product', 'story', 'productplan', 'release', 'project');
|
||||
$objectID = array(1,2,3,4,5);
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->readTest($objectType[0], $objectID[0])) && p('0:objectType,objectID,read') && e('product,1,1'); // 测试对action 1 进行阅读操作
|
||||
r($action->readTest($objectType[1], $objectID[1])) && p('0:objectType,objectID,read') && e('story,2,1'); // 测试对action 2 进行阅读操作
|
||||
r($action->readTest($objectType[2], $objectID[2])) && p('0:objectType,objectID,read') && e('productplan,3,1'); // 测试对action 3 进行阅读操作
|
||||
r($action->readTest($objectType[3], $objectID[3])) && p('0:objectType,objectID,read') && e('release,4,1'); // 测试对action 4 进行阅读操作
|
||||
r($action->readTest($objectType[4], $objectID[4])) && p('0:objectType,objectID,read') && e('project,5,1'); // 测试对action 5 进行阅读操作
|
||||
system("./ztest init");
|
||||
Reference in New Issue
Block a user