znt/module/metric/test/model/gettimeoptions.php

35 lines
2.1 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 metricModel::getTimeOptions();
timeout=0
cid=17128
- 步骤1正常情况第xAxis条的type属性 @category
- 步骤2bar图表第series条的type属性 @bar
- 步骤3大数据量第legend条的type属性 @scroll
- 步骤4空数据第yAxis条的type属性 @value
- 步骤5barY类型第series条的type属性 @bar
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 无需zendata数据准备因为该方法不直接操作数据库
// 3. 用户登录(选择合适角色)
su('admin');
// 4. 创建测试实例(变量名与模块名一致)
$metricTest = new metricModelTest();
// 5. 🔴 强制要求必须包含至少5个测试步骤
r($metricTest->getTimeOptionsTest(array(array('name' => 'value'), array('name' => 'date')), array((object)array('value' => 100, 'date' => '2023-01-01'), (object)array('value' => 200, 'date' => '2023-01-02')), 'line', 'line')) && p('xAxis:type') && e('category'); // 步骤1正常情况
r($metricTest->getTimeOptionsTest(array(array('name' => 'value'), array('name' => 'date')), array((object)array('value' => 150, 'date' => '2023-01-03'), (object)array('value' => 250, 'date' => '2023-01-04')), 'bar', 'bar')) && p('series:type') && e('bar'); // 步骤2bar图表
r($metricTest->getTimeOptionsTest(array(array('name' => 'value'), array('name' => 'date')), array_map(function($i) { return (object)array('value' => $i * 10, 'date' => '2023-01-' . str_pad($i, 2, '0', STR_PAD_LEFT)); }, range(1, 20)), 'line', 'line')) && p('legend:type') && e('scroll'); // 步骤3大数据量
r($metricTest->getTimeOptionsTest(array(array('name' => 'value'), array('name' => 'date')), array(), 'line', 'line')) && p('yAxis:type') && e('value'); // 步骤4空数据
r($metricTest->getTimeOptionsTest(array(array('name' => 'value'), array('name' => 'date')), array_map(function($i) { return (object)array('value' => $i * 10, 'date' => '2023-01-' . str_pad($i, 2, '0', STR_PAD_LEFT)); }, range(1, 20)), 'bar', 'barY')) && p('series:type') && e('bar'); // 步骤5barY类型