+ Add metric test.
This commit is contained in:
@@ -186,6 +186,20 @@ class metricTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test processRecordQuery.
|
||||
*
|
||||
* @param array $query
|
||||
* @param string $key
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function processRecordQuery($query, $key, $type = 'common')
|
||||
{
|
||||
return $this->objectModel->processRecordQuery($query, $key, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试根据code获取度量项数据方法。
|
||||
* Test get metric by code.
|
||||
|
||||
@@ -24,10 +24,10 @@ $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_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,4'); // 测试第二粗度量项的count_of_monthly_created_project
|
||||
r($metric->getResultByCodes($codeList[1], '', 'count_of_monthly_created_project')) && p('0:year,month,value') && e('2023,09,3'); // 测试第二粗度量项的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
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
title=processRecordQuery
|
||||
cid=1
|
||||
pid=1
|
||||
*/
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
$query1 = array('scope' => '1,2');
|
||||
$query2 = array('dateBegin' => '2023-12-04', 'dateEnd' => '2023-12-21', 'dateType' => 'year');
|
||||
$query3 = array('scope' => '3', 'dateLabel' => 'all', 'dateType' => 'year');
|
||||
$query4 = array('calcDate' => '2023-12-24', 'dateType' => 'day');
|
||||
r($metric->processRecordQuery($query1, 'scope')) && p() && e('1,2');
|
||||
r($metric->processRecordQuery($query2, 'scope')) && p() && e('0');
|
||||
r($metric->processRecordQuery($query2, 'dateBegin', 'date')) && p('year,month,week,day') && e('2023,202312,202349,20231204');
|
||||
r($metric->processRecordQuery($query2, 'dateEnd', 'date')) && p('year,month,week,day') && e('2023,202312,202351,20231221');
|
||||
r($metric->processRecordQuery($query2, 'dateLabel', 'date')) && p('0:year,month,week,day;1:year,month,week,day') && e('2023,202312,202349,20231204;2023,202312,202351,20231221');
|
||||
r($metric->processRecordQuery($query3, 'scope')) && p() && e('3');
|
||||
r($metric->processRecordQuery($query3, 'dateBegin', 'date')) && p('year,month,week,day') && e('0,0,0,0');
|
||||
r($metric->processRecordQuery($query3, 'dateEnd', 'date')) && p('year,month,week,day') && e('0,0,0,0');
|
||||
r($metric->processRecordQuery($query3, 'dateLabel', 'date')) && p('0:year,month,week,day') && e('1970,197001,197001,19700101');
|
||||
r($metric->processRecordQuery($query4, 'calcDate', 'date')) && p('year,month,week,day') && e('2023,202312,202351,20231224');
|
||||
Reference in New Issue
Block a user