znt/module/api/test/model/createdemostruct.php

42 lines
1.6 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=测试 apiModel::createDemoStruct();
timeout=0
cid=15097
- 步骤1正常的libID创建演示数据结构 @1
- 步骤2无效libID创建演示数据结构 @1
- 步骤3使用libID=2创建演示数据结构 @1
- 步骤4不同用户账户创建演示数据结构 @1
- 步骤5使用test用户创建演示数据结构 @1
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. zendata数据准备根据需要配置
$doclib = zenData('doclib');
$doclib->id->range('1-10');
$doclib->type->range('api');
$doclib->name->range('测试API库1,测试API库2,测试API库3');
$doclib->baseUrl->range('http://test1.com,http://test2.com,http://test3.com');
$doclib->acl->range('open');
$doclib->gen(3);
// 3. 用户登录(选择合适角色)
su('admin');
// 4. 创建测试实例(变量名与模块名一致)
$apiTest = new apiModelTest();
// 5. 🔴 强制要求必须包含至少5个测试步骤
r($apiTest->createDemoStructTest(1, '16.0', 'admin')) && p() && e('1'); // 步骤1正常的libID创建演示数据结构
r($apiTest->createDemoStructTest(0, '16.0', 'admin')) && p() && e('1'); // 步骤2无效libID创建演示数据结构
r($apiTest->createDemoStructTest(2, '16.0', 'admin')) && p() && e('1'); // 步骤3使用libID=2创建演示数据结构
r($apiTest->createDemoStructTest(3, '16.0', 'user')) && p() && e('1'); // 步骤4不同用户账户创建演示数据结构
r($apiTest->createDemoStructTest(1, '16.0', 'test')) && p() && e('1'); // 步骤5使用test用户创建演示数据结构