#!/usr/bin/env php loadYaml('chart_initchartandpivotcomponent', false, 2)->gen(10); // 3. 用户登录(选择合适角色) su('admin'); // 4. 创建测试实例(变量名与模块名一致) $screenTest = new screenModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 // 测试步骤1:空chart参数测试 r($screenTest->initChartAndPivotComponentTest(null, 'chart')) && p('1') && e('1'); // 测试步骤2:正常chart初始化测试 $chart = new stdclass(); $chart->id = 1; $chart->name = 'Test Chart'; $chart->type = 'cluBarX'; $chart->builtin = 0; $chart->settings = '[{"type":"cluBarX"}]'; $chart->version = 1; r($screenTest->initChartAndPivotComponentTest($chart, 'chart')) && p('0:id') && e('cluBarX'); // 测试步骤3:chart类型设置测试 r($screenTest->initChartAndPivotComponentTest($chart, 'chart')) && p('0:type') && e('table'); // 测试步骤4:pivot类型设置测试 $chart2 = new stdclass(); $chart2->id = 2; $chart2->name = 'Test Table'; $chart2->type = 'table'; $chart2->builtin = 0; $chart2->settings = '[{"type":"table"}]'; $chart2->version = 1; r($screenTest->initChartAndPivotComponentTest($chart2, 'pivot')) && p('0:type') && e('metric'); // 测试步骤5:metric类型设置测试 $chart3 = new stdclass(); $chart3->id = 3; $chart3->name = 'Test Metric'; $chart3->type = 'metric'; $chart3->builtin = 0; $chart3->settings = '[{"type":"metric"}]'; $chart3->version = 1; r($screenTest->initChartAndPivotComponentTest($chart3, 'metric')) && p('0:type') && e('~~');