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

53 lines
2.2 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::getEchartXY();
timeout=0
cid=17097
- 步骤12个元素的header数组 @calcTime,value
- 步骤23个元素的header数组 @scope,value
- 步骤3空header数组 @0
- 步骤41个元素的header数组 @0
- 步骤54个元素的header数组 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/calc.unittest.class.php';
$metricTest = new metricTest();
// 测试数据有2个元素的header数组
$header2Elements = array();
$header2Elements[] = array('name' => 'value', 'title' => '数值', 'width' => 96);
$header2Elements[] = array('name' => 'calcTime', 'title' => '采集时间', 'width' => 128);
// 测试数据有3个元素的header数组
$header3Elements = array();
$header3Elements[] = array('name' => 'scope', 'title' => '产品名称', 'width' => 160);
$header3Elements[] = array('name' => 'value', 'title' => '数值', 'width' => 96);
$header3Elements[] = array('name' => 'calcTime', 'title' => '采集时间', 'width' => 128);
// 测试数据空header数组
$headerEmpty = array();
// 测试数据有1个元素的header数组
$header1Element = array();
$header1Element[] = array('name' => 'date', 'title' => '日期', 'width' => 96);
// 测试数据有4个元素的header数组
$header4Elements = array();
$header4Elements[] = array('name' => 'scope', 'title' => '产品名称', 'width' => 160);
$header4Elements[] = array('name' => 'date', 'title' => '日期', 'width' => 96);
$header4Elements[] = array('name' => 'value', 'title' => '数值', 'width' => 96);
$header4Elements[] = array('name' => 'calcTime', 'title' => '采集时间', 'width' => 128);
r($metricTest->getEchartXY($header2Elements)) && p() && e('calcTime,value'); // 步骤12个元素的header数组
r($metricTest->getEchartXY($header3Elements)) && p() && e('scope,value'); // 步骤23个元素的header数组
r($metricTest->getEchartXY($headerEmpty)) && p() && e('0'); // 步骤3空header数组
r($metricTest->getEchartXY($header1Element)) && p() && e('0'); // 步骤41个元素的header数组
r($metricTest->getEchartXY($header4Elements)) && p() && e('0'); // 步骤54个元素的header数组