* Correct the pivot's unit test.
This commit is contained in:
@@ -17,7 +17,7 @@ pid=1
|
||||
查看id为1000的透视表生成的合并单元格数据是否正确。 >> 10,1;1
|
||||
|
||||
查看id为1001的透视表生成的分组信息是否正确。 >> 一级项目集,项目名称
|
||||
查看id为1001的透视表生成的标签是否正确。 >> 一级项目集,一级项目集;单位时间交付需求规模数;单位时间交付需求规模数
|
||||
查看id为1001的透视表生成的标签是否正确。 >> 一级项目集,一级项目集;单位时间交付需求规模数;单位时间交付需求规模数的求和
|
||||
查看id为1001的透视表生成的列数据是否正确。 >> 项目11,3;项目20,10
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ list($data, $configs) = $pivotTest->genSheet($fields, $pivot->settings, $sql, $f
|
||||
r($data->groups) && p('0,1,2') && e('一级项目集,产品线,产品'); //查看id为1002的透视表生成的分组信息是否正确。
|
||||
r($data->columnTotal) && p('') && e('noShow'); //查看id为1002的透视表是否显示列总计。
|
||||
r(count($data->array)) && p('') && e('11'); //查看id为1002的透视表生成的列数量是否正确
|
||||
r(array_keys($data->array[0])) && p('0,13') && e('一级项目集,Bug修复率'); //查看id为1002的透视表生成的列名称是否正确。
|
||||
r(array_keys($data->array[0])) && p('0,13') && e('一级项目集,Bug修复率10'); //查看id为1002的透视表生成的列名称是否正确。
|
||||
|
||||
$pivot = $pivotTest->getByID($pivotIDList[1]);
|
||||
|
||||
@@ -61,8 +61,8 @@ $langs = json_decode($pivot->langs, true) ?? array();
|
||||
|
||||
list($data, $configs) = $pivotTest->genSheet($fields, $pivot->settings, $sql, $filterFormat, $langs);
|
||||
r($data->groups) && p('0,1') && e('program1,name'); //查看id为1000的透视表生成的分组信息是否正确。
|
||||
r($data->cols[0]) && p('0:name,label;9:name,label') && e('program1,一级项目集;rate,工期偏差率'); //当lang存在时,label选用lang中对应的值。
|
||||
r($data->array) && p('0:name,rate;9:name,rate') && e('项目11,-1.000;项目20,-1.000'); //查看id为1000的透视表生成的列数据是否正确。
|
||||
r($data->cols[0]) && p('0:name,label;9:name,label') && e('program1,一级项目集;rate,工期偏差率的求和'); //当lang存在时,label选用lang中对应的值。
|
||||
r($data->array) && p('0:name,rate7;9:name,rate7') && e('项目11,-1.000;项目20,-1.000'); //查看id为1000的透视表生成的列数据是否正确。
|
||||
r($configs) && p('0:0,1;1:1') && e('10,1;1'); //查看id为1000的透视表生成的合并单元格数据是否正确。
|
||||
|
||||
$pivot = $pivotTest->getByID($pivotIDList[2]);
|
||||
@@ -74,7 +74,7 @@ $fields = json_decode(json_encode($pivot->fieldSettings), true);
|
||||
$langs = json_decode($pivot->langs, true) ?? array();
|
||||
|
||||
list($data, $configs) = $pivotTest->genSheet($fields, $pivot->settings, $sql, $filterFormat, $langs);
|
||||
r($data->groups) && p('0,1') && e('一级项目集,项目名称'); //查看id为1001的透视表生成的分组信息是否正确。
|
||||
r($data->cols[0]) && p('0:name,label;8:name,label') && e('一级项目集,一级项目集;单位时间交付需求规模数;单位时间交付需求规模数'); //查看id为1001的透视表生成的标签是否正确。
|
||||
r($data->array) && p('0:项目名称,消耗工时;9:项目名称,消耗工时') && e('项目11,3;项目20,12'); //查看id为1001的透视表生成的列数据是否正确。
|
||||
r($configs) && p('0:0,1;10:1,1') && e('10,1;1'); //查看id为1001的透视表生成的合并单元格数据是否正确。
|
||||
r($data->groups) && p('0,1') && e('一级项目集,项目名称'); //查看id为1001的透视表生成的分组信息是否正确。
|
||||
r($data->cols[0]) && p('0:name,label;8:name,label') && e('一级项目集,一级项目集;单位时间交付需求规模数,单位时间交付需求规模数的求和'); //查看id为1001的透视表生成的标签是否正确。
|
||||
r($data->array) && p('0:项目名称,消耗工时1;9:项目名称,消耗工时1') && e('项目11,3;项目20,12'); //查看id为1001的透视表生成的列数据是否正确。
|
||||
r($configs) && p('0:0,1;10:1,1') && e('10,1;1'); //查看id为1001的透视表生成的合并单元格数据是否正确。
|
||||
|
||||
@@ -6,6 +6,7 @@ class pivotTest
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('pivot');
|
||||
$this->initPivot();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,8 +22,32 @@ class pivotTest
|
||||
return $this->objectModel->getByID($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔术方法,调用objectModel的方法。
|
||||
* Magic method, call objectModel method.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call(string $name, array $arguments)
|
||||
{
|
||||
return call_user_func_array([$this->objectModel, $name], $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化透视表。
|
||||
* Init pivot table.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function initPivot()
|
||||
{
|
||||
global $tester,$app;
|
||||
$appPath = $app->getAppRoot();
|
||||
$sqlFile = $appPath . 'test/data/pivot.sql';
|
||||
$tester->dbh->exec(file_get_contents($sqlFile));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user