* Fix model unit test.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 7) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 4) . '/calc.class.php';
|
||||
|
||||
zdTable('project')->config('project_status', $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=count_of_dealyed_task_in_user
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试分组数。 @8
|
||||
- 测试用户dev。第0条的value属性 @27
|
||||
|
||||
*/
|
||||
|
||||
r(count($calc->getResult())) && p('') && e('8'); // 测试分组数。
|
||||
|
||||
r($calc->getResult(array('user' => 'dev'))) && p('0:value') && e('27'); // 测试用户dev。
|
||||
@@ -17,7 +17,8 @@ include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
$metric1 = $metric->getByID(1);
|
||||
$metricByCode = $metric->getByCode('count_of_program');
|
||||
$metric1 = $metric->getByID($metricByCode->id);
|
||||
$metric2 = json_decode(json_encode($metric1));
|
||||
$metric2->stage = 'wait';
|
||||
$metric3 = json_decode(json_encode($metric1));
|
||||
|
||||
@@ -8,10 +8,8 @@ timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试count_of_bug @select t1.id from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'
|
||||
- 测试count_of_annual_created_product @select t1.createddate from `zt_product` as t1 where t1.deleted = '0' and t1.shadow = '0' and not find_in_set('or', t1.vision) and not find_in_set('lite', t1.vision)
|
||||
|
||||
- 测试count_of_case_in_product @select t1.product from `zt_case` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0' and not find_in_set('or', t2.vision) and not find_in_set('lite', t2.vision)
|
||||
|
||||
- 测试count_of_annual_created_product @select t1.createddate from `zt_product` as t1 where t1.deleted = '0' and t1.shadow = '0' and t1.vision not like '%or%' and t1.vision not like '%lite%'
|
||||
- 测试count_of_case_in_product @select t1.product from `zt_case` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0' and t2.vision not like '%or%' and t2.vision not like '%lite%'
|
||||
- 测试count_of_annual_fixed_bug_in_product @select t1.product,t1.resolution,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'
|
||||
|
||||
- 测试count_of_daily_closed_bug_in_product @select t1.product,t1.status,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'
|
||||
@@ -30,15 +28,8 @@ $metricList[2] = 'count_of_case_in_product';
|
||||
$metricList[3] = 'count_of_annual_fixed_bug_in_product';
|
||||
$metricList[4] = 'count_of_daily_closed_bug_in_product';
|
||||
|
||||
$expectSQL = array();
|
||||
$expectSQL[0] = "select t1.id from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'";
|
||||
$expectSQL[1] = "select t1.createddate from `zt_product` as t1 where t1.deleted = '0' and t1.shadow = '0' and not find_in_set('or', t1.vision) and not find_in_set('lite', t1.vision)";
|
||||
$expectSQL[2] = "select t1.product from `zt_case` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0' and not find_in_set('or', t2.vision) and not find_in_set('lite', t2.vision)";
|
||||
$expectSQL[3] = "select t1.product,t1.resolution,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'";
|
||||
$expectSQL[4] = "select t1.product,t1.status,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'";
|
||||
|
||||
r($metric->getDataStatement($metricList[0], 'system', 'scale')) && p('') && e("select t1.id from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_bug
|
||||
r($metric->getDataStatement($metricList[1], 'system', 'scale')) && p('') && e("select t1.createddate from `zt_product` as t1 where t1.deleted = '0' and t1.shadow = '0' and not find_in_set('or', t1.vision) and not find_in_set('lite', t1.vision)"); // 测试count_of_annual_created_product
|
||||
r($metric->getDataStatement($metricList[2], 'product', 'scale')) && p('') && e("select t1.product from `zt_case` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0' and not find_in_set('or', t2.vision) and not find_in_set('lite', t2.vision)"); // 测试count_of_case_in_product
|
||||
r($metric->getDataStatement($metricList[3], 'product', 'scale')) && p('') && e("select t1.product,t1.resolution,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_annual_fixed_bug_in_product
|
||||
r($metric->getDataStatement($metricList[4], 'product', 'scale')) && p('') && e("select t1.product,t1.status,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_daily_closed_bug_in_product
|
||||
r($metric->getDataStatement($metricList[0], 'system', 'scale')) && p('') && e("select t1.id from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_bug
|
||||
r($metric->getDataStatement($metricList[1], 'system', 'scale')) && p('') && e("select t1.createddate from `zt_product` as t1 where t1.deleted = '0' and t1.shadow = '0' and t1.vision not like '%or%' and t1.vision not like '%lite%'"); // 测试count_of_annual_created_product
|
||||
r($metric->getDataStatement($metricList[2], 'product', 'scale')) && p('') && e("select t1.product from `zt_case` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0' and t2.vision not like '%or%' and t2.vision not like '%lite%'"); // 测试count_of_case_in_product
|
||||
r($metric->getDataStatement($metricList[3], 'product', 'scale')) && p('') && e("select t1.product,t1.resolution,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_annual_fixed_bug_in_product
|
||||
r($metric->getDataStatement($metricList[4], 'product', 'scale')) && p('') && e("select t1.product,t1.status,t1.closeddate from `zt_bug` as t1 left join `zt_product` as t2 on t1.product=t2.id where t1.deleted = '0' and t2.deleted = '0' and t2.shadow = '0'"); // 测试count_of_daily_closed_bug_in_product
|
||||
@@ -10,23 +10,22 @@ cid=1
|
||||
- 传入resultHeader1和resultData1,获取header
|
||||
- 第0条的name属性 @date
|
||||
- 第1条的name属性 @value
|
||||
- 传入resultHeader1和resultData1,获取data
|
||||
- 第0条的value属性 @1
|
||||
- 第1条的value属性 @3
|
||||
- 传入resultHeader1和resultData1,获取data[0]第value条的0属性 @1
|
||||
- 传入resultHeader1和resultData1,获取data[1]第value条的0属性 @3
|
||||
- 传入resultHeader2和resultData2,获取header
|
||||
- 第0条的name属性 @scope
|
||||
- 第1条的name属性 @2023
|
||||
- 传入resultHeader2和resultData2,获取data
|
||||
- 第0条的scope属性 @开源
|
||||
- 第0条的2023属性 @3
|
||||
- 第1条的scope属性 @ddddw
|
||||
- 第1条的2022属性 @9
|
||||
- 传入resultHeader2和resultData2,获取data[0]
|
||||
- 属性scope @开源
|
||||
- 第2023条的0属性 @3
|
||||
- 传入resultHeader2和resultData2,获取data[1]
|
||||
- 属性scope @ddddw
|
||||
- 第2022条的0属性 @9
|
||||
- 传入resultHeader2和resultData2,获取header
|
||||
- 第0条的name属性 @date
|
||||
- 第1条的name属性 @value
|
||||
- 传入resultHeader2和resultData2,获取data
|
||||
- 第0条的value属性 @1
|
||||
- 第1条的value属性 @1
|
||||
- 传入resultHeader2和resultData2,获取data[0]第value条的0属性 @1
|
||||
- 传入resultHeader2和resultData2,获取data[1]第value条的0属性 @1
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
@@ -72,11 +71,23 @@ $resultData3[] = (object) array('date' => '2023-10-20', 'dateString' => '2023-10
|
||||
$resultData3[] = (object) array('date' => '2023-11-12', 'dateString' => '2023-11-12', 'dateType' => 'day', 'value' => 1, 'calcTime' => '2021-11-23 0:23');
|
||||
$resultData3[] = (object) array('date' => '2023-11-13', 'dateString' => '2023-11-13', 'dateType' => 'day', 'value' => 1, 'calcTime' => '2021-11-23 0:23');
|
||||
|
||||
r($metric->getGroupTable($resultHeader1, $resultData1)) && p('0:name;1:name') && e('date,value'); // 传入resultHeader1和resultData1,获取header
|
||||
r($metric->getGroupTable($resultHeader1, $resultData1, false, false)) && p('0:value;1:value') && e('1,3'); // 传入resultHeader1和resultData1,获取data
|
||||
$group1 = $metric->getGroupTable($resultHeader1, $resultData1);
|
||||
r($group1) && p('0:name;1:name') && e('date,value'); // 传入resultHeader1和resultData1,获取header
|
||||
|
||||
r($metric->getGroupTable($resultHeader2, $resultData2)) && p('0:name;1:name') && e('scope,2023'); // 传入resultHeader2和resultData2,获取header
|
||||
r($metric->getGroupTable($resultHeader2, $resultData2, false, false)) && p('0:scope,2023;1:scope,2022') && e('开源,3;ddddw,9'); // 传入resultHeader2和resultData2,获取data
|
||||
$group1 = $metric->getGroupTable($resultHeader1, $resultData1, false, false);
|
||||
r($group1[0]) && p('value:0') && e('1'); // 传入resultHeader1和resultData1,获取data[0]
|
||||
r($group1[1]) && p('value:0') && e('3'); // 传入resultHeader1和resultData1,获取data[1]
|
||||
|
||||
r($metric->getGroupTable($resultHeader3, $resultData3)) && p('0:name;1:name') && e('date,value'); // 传入resultHeader2和resultData2,获取header
|
||||
r($metric->getGroupTable($resultHeader3, $resultData3, false, false)) && p('0:value;1:value') && e('1;1'); // 传入resultHeader2和resultData2,获取data
|
||||
$group2 = $metric->getGroupTable($resultHeader2, $resultData2);
|
||||
r($group2) && p('0:name;1:name') && e('scope,2023'); // 传入resultHeader2和resultData2,获取header
|
||||
|
||||
$group2 = $metric->getGroupTable($resultHeader2, $resultData2, false, false);
|
||||
r($group2[0]) && p('scope;2023:0') && e('开源,3'); // 传入resultHeader2和resultData2,获取data[0]
|
||||
r($group2[1]) && p('scope;2022:0') && e('ddddw,9'); // 传入resultHeader2和resultData2,获取data[1]
|
||||
|
||||
$group3 = $metric->getGroupTable($resultHeader3, $resultData3);
|
||||
r($group3) && p('0:name;1:name') && e('date,value'); // 传入resultHeader2和resultData2,获取header
|
||||
|
||||
$group3 = $metric->getGroupTable($resultHeader3, $resultData3, false, false);
|
||||
r($group3[0]) && p('value:0') && e('1'); // 传入resultHeader2和resultData2,获取data[0]
|
||||
r($group3[1]) && p('value:0') && e('1'); // 传入resultHeader2和resultData2,获取data[1]
|
||||
@@ -7,7 +7,7 @@ title=getPairsByScope
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试user对象数 @11
|
||||
- 测试user对象数 @10
|
||||
- 测试product对象数 @5
|
||||
- 测试project对象数 @20
|
||||
- 测试部分user对象
|
||||
@@ -36,7 +36,7 @@ zdTable('user')->config('user', true)->gen(30);
|
||||
zdTable('product')->config('product', true)->gen(10);
|
||||
zdTable('project')->config('project', true)->gen(40);
|
||||
|
||||
r(count($metric->getPairsByScope('user'))) && p('') && e('11'); // 测试user对象数
|
||||
r(count($metric->getPairsByScope('user'))) && p('') && e('10'); // 测试user对象数
|
||||
r(count($metric->getPairsByScope('product'))) && p('') && e('5'); // 测试product对象数
|
||||
r(count($metric->getPairsByScope('project'))) && p('') && e('20'); // 测试project对象数
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=getResultByCode
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试度量项count_of_bug第0条的value属性 @24
|
||||
- 测试度量项count_of_annual_created_product
|
||||
- 第0条的year属性 @2023
|
||||
- 第0条的value属性 @5
|
||||
- 测试度量项count_of_monthly_created_project
|
||||
- 第0条的year属性 @2023
|
||||
- 第0条的month属性 @09
|
||||
- 测试度量项count_of_weekly_created_release
|
||||
- 第0条的year属性 @2010
|
||||
- 第0条的week属性 @12
|
||||
- 第0条的value属性 @1
|
||||
- 测试度量项count_of_case_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的value属性 @40
|
||||
- 测试度量项count_of_annual_fixed_bug_in_product
|
||||
- 第0条的year属性 @2012
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的value属性 @3
|
||||
- 测试度量项count_of_monthly_created_bug_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的year属性 @2010
|
||||
- 第0条的month属性 @01
|
||||
- 第0条的value属性 @4
|
||||
- 第1条的product属性 @1
|
||||
- 第1条的year属性 @2010
|
||||
- 第1条的month属性 @02
|
||||
- 第1条的value属性 @2
|
||||
- 测试度量项count_of_daily_closed_bug_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的year属性 @2012
|
||||
- 第0条的month属性 @01
|
||||
- 第0条的day属性 @21
|
||||
- 第0条的value属性 @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
su('admin');
|
||||
$metric = new metricTest();
|
||||
|
||||
zdTable('metriclib')->config('metriclib_system_product', true)->gen(80);
|
||||
zdTable('bug')->config('bug_resolution_status', true)->gen(48);
|
||||
zdTable('product')->config('product', true)->gen(10);
|
||||
zdTable('project')->config('project', true)->gen(80);
|
||||
zdTable('release')->config('release', true)->gen(20);
|
||||
zdTable('case')->config('case', true)->gen(80);
|
||||
|
||||
$codeList = array();
|
||||
$codeList[0] = 'count_of_bug';
|
||||
$codeList[1] = 'count_of_annual_created_product';
|
||||
$codeList[2] = 'count_of_monthly_created_project';
|
||||
$codeList[3] = 'count_of_weekly_created_release';
|
||||
$codeList[4] = 'count_of_case_in_product';
|
||||
$codeList[5] = 'count_of_annual_fixed_bug_in_product';
|
||||
$codeList[6] = 'count_of_monthly_created_bug_in_product';
|
||||
$codeList[7] = 'count_of_daily_closed_bug_in_product';
|
||||
|
||||
r($metric->getResultByCode($codeList[0])) && p('0:value') && e('24'); // 测试度量项count_of_bug
|
||||
r($metric->getResultByCode($codeList[1])) && p('0:year,value') && e('2023,5'); // 测试度量项count_of_annual_created_product
|
||||
r($metric->getResultByCode($codeList[2])) && p('0:year,month') && e('2023,09'); // 测试度量项count_of_monthly_created_project
|
||||
r($metric->getResultByCode($codeList[3])) && p('0:year,week,value') && e('2010,12,1'); // 测试度量项count_of_weekly_created_release
|
||||
r($metric->getResultByCode($codeList[4])) && p('0:product,value') && e('1,40'); // 测试度量项count_of_case_in_product
|
||||
r($metric->getResultByCode($codeList[5])) && p('0:year,product,value') && e('2012,1,3'); // 测试度量项count_of_annual_fixed_bug_in_product
|
||||
r($metric->getResultByCode($codeList[6])) && p('0:product,year,month,value;1:product,year,month,value') && e('1,2010,01,4,1,2010,02,2'); // 测试度量项count_of_monthly_created_bug_in_product
|
||||
r($metric->getResultByCode($codeList[7])) && p('0:product,year,month,day,value') && e('1,2012,01,21,1'); // 测试度量项count_of_daily_closed_bug_in_product
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=getResultByCodes
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试第一组度量项的count_of_bug第0条的value属性 @24
|
||||
- 测试第一组度量项的count_of_annual_created_product
|
||||
- 第0条的year属性 @2023
|
||||
- 第0条的value属性 @5
|
||||
- 测试第二组度量项的count_of_monthly_created_project
|
||||
- 第0条的year属性 @2023
|
||||
- 第0条的month属性 @09
|
||||
- 第0条的value属性 @2
|
||||
- 测试第二组度量项的count_of_weekly_created_release
|
||||
- 第0条的year属性 @2010
|
||||
- 第0条的week属性 @12
|
||||
- 第0条的value属性 @1
|
||||
- 测试第三组度量项的count_of_case_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的value属性 @40
|
||||
- 测试第三组度量项的count_of_annual_fixed_bug_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的year属性 @2012
|
||||
- 第0条的value属性 @3
|
||||
- 测试第三组度量项的count_of_monthly_created_bug_in_product
|
||||
- 第0条的product属性 @1
|
||||
- 第0条的year属性 @2010
|
||||
- 第0条的month属性 @01
|
||||
- 第0条的value属性 @4
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
su('admin');
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
zdTable('metriclib')->config('metriclib_system_product', true)->gen(80);
|
||||
zdTable('bug')->config('bug_resolution_status', true)->gen(48);
|
||||
zdTable('product')->config('product', true)->gen(10);
|
||||
zdTable('project')->config('project', true)->gen(80);
|
||||
zdTable('release')->config('release', true)->gen(20);
|
||||
zdTable('case')->config('case', true)->gen(80);
|
||||
|
||||
$codeList = array();
|
||||
$codeList[0] = array('count_of_bug', 'count_of_annual_created_product');
|
||||
$codeList[1] = array('count_of_monthly_created_project', 'count_of_weekly_created_release');
|
||||
$codeList[2] = array('count_of_case_in_product', 'count_of_annual_fixed_bug_in_product', 'count_of_monthly_created_bug_in_product');
|
||||
|
||||
r($metric->getResultByCodes($codeList[0], '', 'count_of_bug')) && p('0:value') && e('24'); // 测试第一组度量项的count_of_bug
|
||||
r($metric->getResultByCodes($codeList[0], '', 'count_of_annual_created_product')) && p('0:year,value') && e('2023,5'); // 测试第一组度量项的count_of_annual_created_product
|
||||
|
||||
r($metric->getResultByCodes($codeList[1], '', 'count_of_monthly_created_project')) && p('0:year,month,value') && e('2023,09,1'); // 测试第二组度量项的count_of_monthly_created_project
|
||||
r($metric->getResultByCodes($codeList[1], '', 'count_of_weekly_created_release')) && p('0:year,week,value') && e('2010,12,1'); // 测试第二组度量项的count_of_weekly_created_release
|
||||
|
||||
r($metric->getResultByCodes($codeList[2], '', 'count_of_case_in_product')) && p('0:product,value') && e('1,40'); // 测试第三组度量项的count_of_case_in_product
|
||||
r($metric->getResultByCodes($codeList[2], '', 'count_of_annual_fixed_bug_in_product')) && p('0:product,year,value') && e('1,2012,3'); // 测试第三组度量项的count_of_annual_fixed_bug_in_product
|
||||
r($metric->getResultByCodes($codeList[2], '', 'count_of_monthly_created_bug_in_product')) && p('0:product,year,month,value') && e('1,2010,01,4'); // 测试第三组度量项的count_of_monthly_created_bug_in_product
|
||||
@@ -7,9 +7,9 @@ title=getScopePairs
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 获取全部的scopePair,取第一个第0条的value属性 @system
|
||||
- 获取全部的scopePair,取第二个第1条的value属性 @program
|
||||
- 获取部分的scopePair,取第一个第0条的value属性 @system
|
||||
- 获取全部的scopePair,取第一个第0条的value属性 @program
|
||||
- 获取全部的scopePair,取第二个第1条的value属性 @project
|
||||
- 获取部分的scopePair,取第一个第0条的value属性 @project
|
||||
- 获取部分的scopePair,取第二个第1条的value属性 @product
|
||||
|
||||
*/
|
||||
@@ -18,7 +18,7 @@ include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
r($metric->getScopePairs()) && p('0:value') && e('system'); // 获取全部的scopePair,取第一个
|
||||
r($metric->getScopePairs()) && p('1:value') && e('program'); // 获取全部的scopePair,取第二个
|
||||
r($metric->getScopePairs(false)) && p('0:value') && e('system'); // 获取部分的scopePair,取第一个
|
||||
r($metric->getScopePairs()) && p('0:value') && e('program'); // 获取全部的scopePair,取第一个
|
||||
r($metric->getScopePairs()) && p('1:value') && e('project'); // 获取全部的scopePair,取第二个
|
||||
r($metric->getScopePairs(false)) && p('0:value') && e('project'); // 获取部分的scopePair,取第一个
|
||||
r($metric->getScopePairs(false)) && p('1:value') && e('product'); // 获取部分的scopePair,取第二个
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=initActionBtn
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试正常插入 @3
|
||||
- 测试空数组 @6
|
||||
- 测试null @10
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
su('admin');
|
||||
zdTable('metriclib')->config('metriclib_system_product', true)->gen(0);
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
$records1 = array
|
||||
(
|
||||
array('metricID' => 107, 'metricCode' => 'count_of_bug', 'value' => 10, 'date' => '2020-01-01'),
|
||||
array('metricID' => 108, 'metricCode' => 'count_of_actived_bug', 'value' => 5, 'date' => '2020-01-01'),
|
||||
array('metricID' => 110, 'metricCode' => 'count_of_closed_bug', 'value' => 3, 'date' => '2020-01-01')
|
||||
);
|
||||
|
||||
$records2 = array
|
||||
(
|
||||
array('metricID' => 107, 'metricCode' => 'count_of_bug', 'value' => 10, 'date' => '2020-01-01'),
|
||||
array('metricID' => 108, 'metricCode' => 'count_of_actived_bug', 'value' => 5, 'date' => '2020-01-01'),
|
||||
array('metricID' => 110, 'metricCode' => 'count_of_closed_bug', 'value' => 3, 'date' => '2020-01-01'),
|
||||
array()
|
||||
);
|
||||
|
||||
$records3 = array
|
||||
(
|
||||
array('metricID' => 107, 'metricCode' => 'count_of_bug', 'value' => 10, 'date' => '2020-01-01'),
|
||||
array('metricID' => 108, 'metricCode' => 'count_of_actived_bug', 'value' => 5, 'date' => '2020-01-01'),
|
||||
array('metricID' => 110, 'metricCode' => 'count_of_closed_bug', 'value' => 3, 'date' => '2020-01-01'),
|
||||
array('metricID' => 110, 'metricCode' => 'count_of_closed_bug', 'value' => 6, 'date' => '2020-01-02'),
|
||||
null
|
||||
);
|
||||
|
||||
r($metric->insertMetricLib($records1)) && p('') && e('3'); // 测试正常插入
|
||||
r($metric->insertMetricLib($records2)) && p('') && e('6'); // 测试空数组
|
||||
r($metric->insertMetricLib($records3)) && p('') && e('10'); // 测试null
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=isFirstGenerate
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 第一次获取,此时表里有数据 @0
|
||||
- 第二次获取,经过第一次表已经被清空 @1
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
zdTable('metriclib')->config('metriclib_system_product', true)->gen(80);
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
r($metric->isFirstGenerate()) && p() && e('0'); // 第一次获取,此时表里有数据
|
||||
r($metric->isFirstGenerate()) && p() && e('1'); // 第二次获取,经过第一次表已经被清空
|
||||
Reference in New Issue
Block a user