* Add unit test for metricModel-getDateLabels.
This commit is contained in:
@@ -160,4 +160,16 @@ class metricTest
|
||||
|
||||
return $dataset->$dataSource($fieldList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getDateLabels()
|
||||
*
|
||||
* @param string $dateType
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDateLabels($dateType)
|
||||
{
|
||||
return $this->objectModel->getDateLabels($dateType);
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
su('admin');
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
/**
|
||||
|
||||
title=getDateLabels
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
r($metric->getDateLabels('year')) && p('3;5;10;all') && e('近3年,近5年,近10年,全部'); // 测试传入year的情况
|
||||
r($metric->getDateLabels('month')) && p('6;12;24;36') && e('近6月,近12月,近24月,近36月'); // 测试传入month的情况
|
||||
r($metric->getDateLabels('week')) && p('4;8;12;16') && e('近4周,近8周,近12周,近16周'); // 测试传入week的情况
|
||||
r($metric->getDateLabels('day')) && p('7;14;21;28') && e('近7天,近14天,近21天,近28天'); // 测试传入day的情况
|
||||
Reference in New Issue
Block a user