* Add unit test for metricModel-getControlOptions.
This commit is contained in:
@@ -134,6 +134,18 @@ class metricTest
|
||||
return $this->objectModel->getPairsByScope($scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getControlOptions method.
|
||||
*
|
||||
* @param string $scope
|
||||
* @access public
|
||||
* @return array|false
|
||||
*/
|
||||
public function getControlOptions($optionType)
|
||||
{
|
||||
return $this->objectModel->getControlOptions($optionType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 getScopePairs 方法。
|
||||
* Test getScopePairs method.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
title=getControlOptions
|
||||
cid=1
|
||||
pid=1
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/calc.class.php';
|
||||
su('admin');
|
||||
|
||||
$metric = new metricTest();
|
||||
|
||||
zdTable('user')->config('user', true)->gen(30);
|
||||
zdTable('product')->config('product', true)->gen(10);
|
||||
zdTable('project')->config('project', true)->gen(40);
|
||||
|
||||
r(count($metric->getControlOptions('user'))) && p('') && e('11'); // 测试user对象数
|
||||
r(count($metric->getControlOptions('product'))) && p('') && e('5'); // 测试product对象数
|
||||
r(count($metric->getControlOptions('project'))) && p('') && e('7'); // 测试project对象数
|
||||
Reference in New Issue
Block a user