* Add unit test for screenModel::genNewChartData.
This commit is contained in:
@@ -97,7 +97,7 @@ class screenModel extends model
|
||||
$this->filter->charts = array();
|
||||
|
||||
if($screen->id == 5) return new stdclass();
|
||||
if(!$screen->builtin || in_array($screen->id, $this->config->screen->builtinScreen)) return $this->genNewChartData($screen, $year, $dept, $account);
|
||||
if(!$screen->builtin || in_array($screen->id, $this->config->screen->builtinScreen)) return $this->genNewChartData($screen);
|
||||
|
||||
$config = new stdclass();
|
||||
$config->width = 1300;
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 screenModel->buildChart();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 判断所有的组件以及内部的图表是否都被处理了。 @0
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/screen.class.php';
|
||||
|
||||
$screenTest = new screenTest();
|
||||
|
||||
$screenID = 6;
|
||||
|
||||
$screen = $tester->dao->select('*')->from(TABLE_SCREEN)->where('id')->eq($screenID)->fetch();
|
||||
|
||||
$oriScheme = json_decode($screen->scheme);
|
||||
|
||||
$componentList = array_map(function($component){return clone($component);}, $oriScheme->componentList);
|
||||
|
||||
$handleScheme = $screenTest->genNewChartData($screen);
|
||||
|
||||
$fComponentList = $handleScheme->componentList;
|
||||
|
||||
$check = false;
|
||||
foreach($componentList as $key => $component) $check = serialize($component) == serialize($fComponentList[$key]);
|
||||
r($check) && p('') && e(0); //判断所有的组件以及内部的图表是否都被处理了。
|
||||
Reference in New Issue
Block a user