* Add unit test for metrics.

This commit is contained in:
zhouxin
2023-07-27 16:23:01 +08:00
parent ab80242586
commit 53ab0950e7
4 changed files with 67 additions and 0 deletions
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10);
zdTable('project')->config('execution', $useCommon = true, $levels = 4)->gen(20, false);
zdTable('task')->config('task', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=consume_of_task
cid=1
pid=1
*/
r($calc->getResult()) && p('0:value') && e('640'); // 测试消耗工时
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10);
zdTable('project')->config('execution', $useCommon = true, $levels = 4)->gen(20, false);
zdTable('task')->config('task', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=estimate_of_task
cid=1
pid=1
*/
r($calc->getResult()) && p('0:value') && e('640'); // 测试预计工时
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10);
zdTable('project')->config('execution', $useCommon = true, $levels = 4)->gen(20, false);
zdTable('task')->config('task', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=left_of_task
cid=1
pid=1
*/
r($calc->getResult()) && p('0:value') && e('640'); // 测试剩余工时
+4
View File
@@ -15,8 +15,12 @@ fields:
range: "20100101 000000-20210101 230000:10D"
type: timestamp
format: YYYY-MM-DD hh:mm:ss
- field: estimate
range: 1{10},2{9},4{8},5{7},6{5},8{4},10{1},
- field: consumed
range: 1{10},2{9},4{8},5{7},6{5},8{4},10{1},
- field: left
range: 1{10},2{9},4{8},5{7},6{5},8{4},10{1},
- field: status
range: wait{1},doing{1},done{1},pause{1},cancel{1},closed{1}
- field: deleted