znt/module/bi/test/model/preparebuilitinpivotdrillsql.php

73 lines
2.4 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
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
/**
title=测试 biModel::prepareBuilitinPivotDrillSQL();
timeout=0
cid=15196
- 步骤1空下钻数组情况 @0
- 步骤2单个下钻配置情况删除+插入SQL @2
- 步骤3多个下钻配置情况删除+2个插入SQL @3
- 步骤4复杂条件下钻配置 @2
- 步骤5特殊字符下钻配置 @2
*/
$biTest = new biModelTest();
// 测试步骤1空下钻数组情况
r(count($biTest->prepareBuilitinPivotDrillSQLTest(1, array(), 1))) && p() && e('0'); // 步骤1空下钻数组情况
// 测试步骤2单个下钻配置情况
$singleDrill = array(
array(
'field' => 'status',
'object' => 'bug',
'whereSql' => 'status = "active"',
'condition' => array('status' => 'active')
)
);
r(count($biTest->prepareBuilitinPivotDrillSQLTest(1, $singleDrill, 1))) && p() && e('2'); // 步骤2单个下钻配置情况删除+插入SQL
// 测试步骤3多个下钻配置情况
$multipleDrills = array(
array(
'field' => 'status',
'object' => 'bug',
'whereSql' => 'status = "active"',
'condition' => array('status' => 'active')
),
array(
'field' => 'pri',
'object' => 'bug',
'whereSql' => 'pri = "high"',
'condition' => array('pri' => 'high')
)
);
r(count($biTest->prepareBuilitinPivotDrillSQLTest(2, $multipleDrills, 1))) && p() && e('3'); // 步骤3多个下钻配置情况删除+2个插入SQL
// 测试步骤4复杂条件下钻配置
$complexDrill = array(
array(
'field' => 'assignedTo',
'object' => 'task',
'whereSql' => 'assignedTo IN ("user1", "user2")',
'condition' => array('assignedTo' => array('user1', 'user2'), 'status' => 'doing')
)
);
r(count($biTest->prepareBuilitinPivotDrillSQLTest(3, $complexDrill, 2))) && p() && e('2'); // 步骤4复杂条件下钻配置
// 测试步骤5特殊字符下钻配置
$specialDrill = array(
array(
'field' => 'title',
'object' => 'story',
'whereSql' => 'title LIKE "%测试%"',
'condition' => array('title' => '测试\'特殊"字符')
)
);
r(count($biTest->prepareBuilitinPivotDrillSQLTest(4, $specialDrill, 1))) && p() && e('2'); // 步骤5特殊字符下钻配置