znt/module/action/test/tao/getdocliblinkparameters.php

94 lines
3.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=测试 actionTao::getDocLibLinkParameters();
timeout=0
cid=14947
- 步骤1正常情况 @custom
- 步骤2边界值 @product
- 步骤3异常输入 @execution
- 步骤4权限验证 @project
- 步骤5业务规则 @execution
- 步骤6复杂业务逻辑 @product
- 步骤7数据处理属性2 @10
- 步骤8错误处理 @0
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/tao.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$actionTest = new actionTaoTest();
// 4. 🔴 强制要求必须包含至少5个测试步骤
// 测试步骤1自定义类型文档库无product、project、execution
$action1 = new stdClass();
$action1->objectID = 1;
$action1->product = '';
$action1->project = '';
$action1->execution = '';
r($actionTest->getDocLibLinkParametersTest($action1)) && p('0') && e('custom'); // 步骤1正常情况
// 测试步骤2产品类型文档库只有product属性
$action2 = new stdClass();
$action2->objectID = 2;
$action2->product = '3';
$action2->project = '';
$action2->execution = '';
r($actionTest->getDocLibLinkParametersTest($action2)) && p('0') && e('product'); // 步骤2边界值
// 测试步骤3执行类型文档库有execution属性
$action3 = new stdClass();
$action3->objectID = 3;
$action3->product = '';
$action3->project = '';
$action3->execution = '5';
r($actionTest->getDocLibLinkParametersTest($action3)) && p('0') && e('execution'); // 步骤3异常输入
// 测试步骤4项目类型文档库只有project属性
$action4 = new stdClass();
$action4->objectID = 4;
$action4->product = '';
$action4->project = '6';
$action4->execution = '';
r($actionTest->getDocLibLinkParametersTest($action4)) && p('0') && e('project'); // 步骤4权限验证
// 测试步骤5execution优先于project的测试
$action5 = new stdClass();
$action5->objectID = 5;
$action5->product = '';
$action5->project = '8';
$action5->execution = '9';
r($actionTest->getDocLibLinkParametersTest($action5)) && p('0') && e('execution'); // 步骤5业务规则
// 测试步骤6优先级测试product优先级最高
$action6 = new stdClass();
$action6->objectID = 6;
$action6->product = '7';
$action6->project = '8';
$action6->execution = '9';
r($actionTest->getDocLibLinkParametersTest($action6)) && p('0') && e('product'); // 步骤6复杂业务逻辑
// 测试步骤7边界值测试带逗号的libObjectID处理
$action7 = new stdClass();
$action7->objectID = 7;
$action7->product = ',10,';
$action7->project = '';
$action7->execution = '';
r($actionTest->getDocLibLinkParametersTest($action7)) && p('2') && e('10'); // 步骤7数据处理
// 测试步骤8边界值测试空的libObjectID导致返回false
$action8 = new stdClass();
$action8->objectID = 8;
$action8->product = ',';
$action8->project = '';
$action8->execution = '';
r($actionTest->getDocLibLinkParametersTest($action8)) && p() && e('0'); // 步骤8错误处理