znt/module/screen/test/model/checkifchartinuse.php

42 lines
2.3 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=测试 screenModel::checkIFChartInUse();
timeout=0
cid=18222
- 步骤1检查chart类型图表被使用 @1
- 步骤2检查pivot类型图表被使用 @1
- 步骤3检查metric类型图表被使用 @1
- 步骤4检查分组中的chart类型图表被使用 @1
- 步骤5检查不存在的图表ID @0
- 步骤6检查无效的图表ID0 @0
- 步骤7检查错误的type参数正确的是chart @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
global $tester;
$tester->dbh->exec("TRUNCATE zt_screen");
$tester->dbh->exec("INSERT INTO zt_screen (id, name, scheme, status, deleted) VALUES
(1, 'Test Screen 1', '{\"componentList\":[{\"chartConfig\":{\"sourceID\":\"101\",\"package\":\"Charts\"},\"isGroup\":false}]}', 'published', '0'),
(2, 'Test Screen 2', '{\"componentList\":[{\"chartConfig\":{\"sourceID\":\"102\",\"package\":\"Tables\"},\"isGroup\":false}]}', 'published', '0'),
(3, 'Test Screen 3', '{\"componentList\":[{\"chartConfig\":{\"sourceID\":\"103\",\"package\":\"Metrics\"},\"isGroup\":false}]}', 'published', '0'),
(4, 'Group Screen', '{\"componentList\":[{\"isGroup\":true,\"groupList\":[{\"chartConfig\":{\"sourceID\":\"104\",\"package\":\"Charts\"}}]}]}', 'published', '0'),
(5, 'Empty Screen', '{\"componentList\":[]}', 'published', '0')");
su('admin');
$screenTest = new screenModelTest();
r($screenTest->checkIFChartInUseTest('101', 'chart')) && p() && e('1'); // 步骤1检查chart类型图表被使用
r($screenTest->checkIFChartInUseTest('102', 'pivot')) && p() && e('1'); // 步骤2检查pivot类型图表被使用
r($screenTest->checkIFChartInUseTest('103', 'metric')) && p() && e('1'); // 步骤3检查metric类型图表被使用
r($screenTest->checkIFChartInUseTest('104', 'chart')) && p() && e('1'); // 步骤4检查分组中的chart类型图表被使用
r($screenTest->checkIFChartInUseTest('999', 'chart')) && p() && e('0'); // 步骤5检查不存在的图表ID
r($screenTest->checkIFChartInUseTest('0', 'chart')) && p() && e('0'); // 步骤6检查无效的图表ID0
r($screenTest->checkIFChartInUseTest('101', 'pivot')) && p() && e('0'); // 步骤7检查错误的type参数正确的是chart