* Code formatter.

This commit is contained in:
wangxuepeng
2023-12-04 15:25:31 +08:00
parent b1bc7e20ef
commit 90d48cef7a
6 changed files with 43 additions and 30 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ cid=1
pid=1
有图表id的元素判断是否正常生成了刻度和数据。 >> 1
目前没有Select组件,所以这里应该是false。 >> 0
判断是否正常生成了Select组件 >> 1
非列表的组件判断是否给予了默认的属性。 >> 1
列表的组件判断是否给予了默认的属性。 >> 1
@@ -48,7 +48,7 @@ if($component1) $screen->buildComponentTest($component1);
r(isset($component1->option->dataset->dimensions) && is_array($component1->option->dataset->dimensions)) && p('') && e('1'); //有图表id的元素判断是否正常生成了刻度和数据。
if($component2) $screen->buildComponentTest($component2);
r(isset($component2) && $component2->option->dataset[0]['label'] == '2023') && p('') && e('0'); //判断是否正常生成了Select组件。
r(isset($component2) && $component2->option->dataset[0]['label'] == '2023') && p('') && e('1'); //判断是否正常生成了Select组件。
if($component3) $screen->buildComponentTest($component3);
r($component3->styles && $component->status && $component->request) && p('') && e('1'); //非列表的组件判断是否给予了默认的属性。
@@ -9,6 +9,13 @@ title=测试 screenModel->completeComponent(), $screeModel->getChartFilters();
cid=1
pid=1
当chart为空时,使用默认配置。 >> transparent,1
当chart->stge为draft时,使用默认配置。 >> 暂时没有数据,center
测试组件类型为chart并且chart->stage为chart时option的配置项。 >> 1,2
测试组件类型为chart并且chart->stage为chart时chartConfig的配置项。 >> 1,2
测试组件类型为chart并且chart->stage为chart时组件的类型。 >> chart
测试雷达组件是否能正常生成。 >> radar
*/
$chart = new stdclass();
+5 -3
View File
@@ -2,8 +2,10 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/screen.class.php';
su('admin');
zdTable('project')->config('project')->gen(1);
zdTable('project')->gen(0);
zdTable('project')->config('project')->gen(1, false ,false);
zdTable('project')->config('execution_burn')->gen(30, false, false);
/**
@@ -11,7 +13,7 @@ title=测试 screenModel->getBurnData();
cid=1
pid=1
测试生成的数据条数 >> 5
测试生成的数据条数 >> 16
测试生成的数据是否正确 >> 项目集1--项目集4
测试生成的标签数据是否正确 >> 7/9
*/
@@ -20,6 +22,6 @@ $screen = new screenTest();
$data = $screen->getBurnDataTest();
r(count($data)) && p('') && e(5); //测试生成的数据条数
r(count($data)) && p('') && e(16); //测试生成的数据条数
r($data) && p('104:name') && e('项目集1--项目集4'); //测试生成的数据是否正确
r($data[104]->chartData) && p('labels:0') && e('7/9'); //测试生成的标签数据是否正确
+2 -1
View File
@@ -79,7 +79,8 @@ $chart5->filters = json_encode(array($filters));
$chart5->fields = json_encode(array());
$time = date('Y-m-d', time() - (date('N') - 1) * 24 * 3600);
r($screen->getChartFiltersTest($chart)) && p('0:default') && e('1701014400000'); //当from为query时,type为date时,default应该为当前周一的日期,检查是否生成了正确的时间。
$result = $screen->getChartFiltersTest($chart);
r(date('Y-m-d', $result[0]['default'] / 1000) == $time) && p('') && e('1'); //当from为query时,type为date时,default应该为当前周一的日期,检查是否生成了正确的时间。
$result = $screen->getChartFiltersTest($chart1);
r($result[0]['options']) && p('0:value') && e('admin'); //当from为query时,type为select时,options应该为用户列表,检查是否生成了正确的用户列表。
+26 -24
View File
@@ -2,6 +2,8 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/screen.class.php';
su('admin');
zdTable('project')->gen(50);
zdTable('story')->gen(20);
zdTable('bug')->gen(20);
@@ -11,19 +13,19 @@ title=测试 screenModel->getchartoption();
cid=1
pid=1
测试获取折线图配置中dimensions是否正确,值为年份。 >> 1
测试获取折线图配置中source是否正确。 >> 1
测试type为cluBarY的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试获取折线图配置中dimensions是否正确,值为年份。 >> 1
测试获取折线图配置中source是否正确。 >> 1
测试type为cluBarY的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为stackedBarY的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。 >> 0
测试type为cluBarX的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为stackedBar的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为bar的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。 >> 0
测试type为piecircle的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为pie的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为table的图表是否显示正确,生成的header指标项数量是否正确。 >> 1
测试type为table的图表是否显示正确,生成的dataset数据项数量是否正确。 >> 1
测试配置错误的水球图是否能正常生成,此为默认配置。 >> 1
测试配置正确的水球图是否能正常生成,生成的比例为0.000。 >> 1
测试type为cluBarX的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为stackedBar的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为bar的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。 >> 0
测试type为piecircle的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为pie的图表是否显示正确,生成的指标项和数据项是否正确。 >> 1
测试type为table的图表是否显示正确,生成的header指标项数量是否正确。 >> 1
测试type为table的图表是否显示正确,生成的dataset数据项数量是否正确。 >> 1
测试配置错误的水球图是否能正常生成,此为默认配置。 >> 1
测试配置正确的水球图是否能正常生成,生成的比例为0.000。 >> 1
*/
@@ -58,10 +60,10 @@ $filter10 = array('type' => 'waterpolo');
list($component1, $chart1) = getComponetAndChart($screen, $filter1);
$screen->getChartOptionTest($chart1, $component1);
$dimension_0 = $component1->option->dataset->dimensions[0] ?? null;
r($dimension_0 && $dimension_0 == '年份') && p('') && e('1'); //测试获取折线图配置中dimensions是否正确,值为年份。
$year = date('Y');
$source_0 = $component1->option->dataset->source[0];
r($dimension_0 && $source_0 && $source_0->{$dimension_0} == $year) && p('') && e('1'); //测试获取折线图配置中source是否正确。
r($dimension_0 && $dimension_0 == '年份') && p('') && e('1'); //测试获取折线图配置中dimensions是否正确,值为年份。
r($dimension_0 && $source_0 && $source_0->{$dimension_0} == $year) && p('') && e('1'); //测试获取折线图配置中source是否正确。
list($component2, $chart2) = getComponetAndChart($screen, $filter2);
$screen->getChartOptionTest($chart2, $component2);
@@ -70,10 +72,10 @@ r(
&& $component2->option->dataset
&& $component2->option->dataset->dimensions[0] == 'name'
&& count($component2->option->dataset->source) == 5
) && p('') && e('1'); //测试type为cluBarY的图表是否显示正确,生成的指标项和数据项是否正确。
) && p('') && e('1'); //测试type为cluBarY的图表是否显示正确,生成的指标项和数据项是否正确。
list($component3, $chart3) = getComponetAndChart($screen, $filter3);
r($component3 && $chart3) && p('') && e('0'); //测试type为stackedBarY的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。
r($component3 && $chart3) && p('') && e('0'); //测试type为stackedBarY的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。
list($component4, $chart4) = getComponetAndChart($screen, $filter4);
$screen->getChartOptionTest($chart4, $component4);
@@ -81,7 +83,7 @@ r(
isset($component4->option->dataset->dimensions[0])
&& $component4->option->dataset->dimensions[0] == 'project'
&& count($component4->option->dataset->source) == 5
) && p('') && e(1); //测试type为cluBarX的图表是否显示正确,生成的指标项和数据项是否正确。
) && p('') && e(1); //测试type为cluBarX的图表是否显示正确,生成的指标项和数据项是否正确。
list($component5, $chart5) = getComponetAndChart($screen, $filter5);
$screen->getChartOptionTest($chart5, $component5);
@@ -89,7 +91,7 @@ $dataset = isset($component5) && $component5->option->dataset ? $component5->opt
r($dataset && $dataset->dimensions[0] == '年份' && count($dataset->source) == 1) && p('') && e(1); // 测试type为stackedBar的图表是否显示正确,生成的指标项和数据项是否正确。
list($component6, $chart6) = getComponetAndChart($screen, $filter6);
r($component6 && $chart6) && p('') && e(0); //测试type为bar的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。
r($component6 && $chart6) && p('') && e(1); //测试type为bar的图表是否显示正确,由于目前系统里没有这种类型的图表,故不作展示。
list($component7, $chart7) = getComponetAndChart($screen, $filter7);
$screen->getChartOptionTest($chart7, $component7);
@@ -97,25 +99,25 @@ r(
isset($component7->option->series[0]->data[0]->value[0])
&& isset($component7->option->dataset)
&& $component7->option->dataset === $component7->option->series[0]->data[0]->value[0]
) && p('') && e(1); // 测试type为piecircle的图表是否显示正确,生成的指标项和数据项是否正确。
) && p('') && e(1); // 测试type为piecircle的图表是否显示正确,生成的指标项和数据项是否正确。
list($component8, $chart8) = getComponetAndChart($screen, $filter8);
$screen->getChartOptionTest($chart8, $component8);
$dataset = $component8->option->dataset ?? null;
r($dataset->dimensions[1] == 'id' && $dataset->source[0]->id == 5) && p('') && e(1); //测试type为pie的图表是否显示正确,生成的指标项和数据项是否正确。
r($dataset->dimensions[1] == 'id' && $dataset->source[0]->id == 5) && p('') && e(1); //测试type为pie的图表是否显示正确,生成的指标项和数据项是否正确。
list($component9, $chart9) = getComponetAndChart($screen, $filter9);
$screen->getChartOptionTest($chart9, $component9);
$option = $component9->option;
r(isset($option->header[0]) && count($option->header[0]) == 10) && p('') && e(1); //测试type为table的图表是否显示正确,生成的header指标项数量是否正确。
r(isset($option->dataset[0]) && count($option->dataset[0]) == 10) && p('') && e(1); //测试type为table的图表是否显示正确,生成的dataset数据项数量是否正确。
r(isset($option->header[0]) && count($option->header[0]) == 10) && p('') && e(1); //测试type为table的图表是否显示正确,生成的header指标项数量是否正确。
r(isset($option->dataset[0]) && count($option->dataset[0]) == 10) && p('') && e(1); //测试type为table的图表是否显示正确,生成的dataset数据项数量是否正确。
list($component10, $chart10) = getComponetAndChart($screen, $filter10);
$screen->getChartOptionTest($chart10, $component10);
r(is_float($component10->option->dataset)) && p('') && e('1'); //测试配置错误的水球图是否能正常生成,此为默认配置。
r(is_float($component10->option->dataset)) && p('') && e('1'); //测试配置错误的水球图是否能正常生成,此为默认配置。
$component11_all = array_filter($screen->componentList, function($item){ return isset($item->type) && $item->type == 'waterpolo' && $item->id != '58c9hdcwi5s000'; });
$component11 = current($component11_all);
$chart11 = $tester->dao->select('*')->from(TABLE_CHART)->where('id')->eq($component11->sourceID)->fetch();
$screen->getChartOptionTest($chart11, $component11);
r($component11->option->dataset == "0.000") && p('') && e(1); //测试配置正确的水球图是否能正常生成,生成的比例为0.000。
r($component11->option->dataset == "0.000") && p('') && e(1); //测试配置正确的水球图是否能正常生成,生成的比例为0.000。
@@ -8,6 +8,7 @@ title=测试 screenModel->getByID();
cid=1
pid=1
测试是否能正常处理横坐标为日期,类型为日期,对象类型为bug的情况。 >> 2023-11-03,2023-11-07,2023-11-13,2023-11-15
*/