znt/module/project/test/model/updateuserview.php

37 lines
1.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
/**
title=测试 projectModel::updateUserView();
timeout=0
cid=17882
- 步骤1ACL为open时直接返回true @1
- 步骤2ACL为private时更新用户视图 @1
- 步骤3不存在的项目ID @1
- 步骤4ACL为空字符串 @1
- 步骤5包含执行的项目验证执行视图更新 @1
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. zendata数据准备根据需要配置
zenData('project')->loadYaml('project_updateuserview', false, 2)->gen(10);
// 3. 用户登录(选择合适角色)
su('admin');
// 4. 创建测试实例(变量名与模块名一致)
$projectTest = new projectModelTest();
// 5. 🔴 强制要求必须包含至少5个测试步骤
r($projectTest->updateUserViewTest(1, 'open')) && p() && e('1'); // 步骤1ACL为open时直接返回true
r($projectTest->updateUserViewTest(1, 'private')) && p() && e('1'); // 步骤2ACL为private时更新用户视图
r($projectTest->updateUserViewTest(999, 'private')) && p() && e('1'); // 步骤3不存在的项目ID
r($projectTest->updateUserViewTest(2, '')) && p() && e('1'); // 步骤4ACL为空字符串
r($projectTest->updateUserViewTest(1, 'custom')) && p() && e('1'); // 步骤5包含执行的项目验证执行视图更新