* Unit test of the computebeginandend method of action module.

This commit is contained in:
wangxuepeng
2023-09-18 05:39:58 +00:00
parent c17c689c78
commit a4cb4c8192
3 changed files with 16 additions and 18 deletions
+4 -4
View File
@@ -393,11 +393,11 @@ class actionTest
$date = $this->objectModel->computeBeginAndEnd($period);
$today = date('Y-m-d');
$tomorrow = date::tomorrow();
$yesterday = date::yesterday();
$twoDaysAgo = date::twoDaysAgo();
$tomorrow = date('Y-m-d', strtotime('+1 days'));
$yesterday = date('Y-m-d', strtotime('-1 days'));
$twoDaysAgo = date('Y-m-d', strtotime('-2 days'));
if($period == 'all') return $date['begin'] == '1970-1-1' and $date['end'] == '2109-1-1';
if($period == 'all') return $date['begin'] == '1970-01-01' and $date['end'] == '2030-01-01';
if($period == 'today') return $date['begin'] == $today and $date['end'] == $tomorrow;
if($period == 'yesterday') return $date['begin'] == $yesterday and $date['end'] == $today;
if($period == 'twodaysago') return $date['begin'] == $twoDaysAgo and $date['end'] == $yesterday;
@@ -10,15 +10,15 @@ title=测试 actionModel->computeBeginAndEnd();
cid=1
pid=1
测试计算all的日期 >> 1
测试计算today的日期 >> 1
测试计算yesterday的日期 >> 1
测试计算twodaysago的日期 >> 1
测试计算all的日期 >> 1
测试计算today的日期 >> 1
测试计算yesterday的日期 >> 1
测试计算twodaysago的日期 >> 1
测试计算latest3days的日期 >> 1
测试计算thisweek的日期 >> 1
测试计算lastweek的日期 >> 1
测试计算thismonth的日期 >> 1
测试计算lastmonth的日期 >> 1
测试计算thisweek的日期 >> 1
测试计算lastweek的日期 >> 1
测试计算thismonth的日期 >> 1
测试计算lastmonth的日期 >> 1
*/
@@ -34,4 +34,4 @@ r($action->computeBeginAndEndTest($typeList[4])) && p() && e('1'); // 测试计
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的日期
r($action->computeBeginAndEndTest($typeList[8])) && p() && e('1'); // 测试计算lastmonth的日期
+3 -5
View File
@@ -13,11 +13,9 @@ title=测试 actionModel->getHistory();
cid=1
pid=1
查找actionID为1的历史记录 >> resolution,1,2
查找actionID为2的历史记录 >> resolvedBuild,2,3
查找actionID为3的历史记录 >> resolvedDate,2020-01-01,2020-01-17
查找actionID为4的历史记录 >> status,doing,done
查找actionID为5的历史记录 >> resolution,1,2
查找actionID为1的历史记录 >> resolution,1,2
查找actionID为2的历史记录 >> resolvedBuild,2,3
查找actionID为10000的历史记录 >> 0
*/