\Tests\FeatureP3Batch4Test

测试基座(抽象基类)

被测对象:无(公共测试设施) 守护约定:Redis 直连用例在无 Redis 环境(如 CI)跳过而非失败(TEST_REQUIRE_REDIS=1 可强制失败); 缓存注册表最小 schema 供 sqlite :memory: 下凡走注册表的用例自建。

Summary

Methods
Properties
Constants
test_file_scene_valid_is_dict_first()
test_file_scene_builtin_fallback_when_dict_empty()
test_template_render_rejects_unregistered_type()
test_template_render_key_auth_required_when_not_public()
test_template_render_key_rotation_grace_then_revoke()
test_companies_ids_returns_full_list_beyond_pagination_cap()
test_template_types_display_name_sourced_from_dict()
test_template_category_dict_matches_code_contract()
test_super_role_anchor_write_protection()
test_super_post_anchor_write_protection()
No public properties found
No constants found
makeDef()
requireRedis()
buildCacheRegistry()
No protected properties found
N/A
seedSceneDict()
seedDict()
makeRenderKeyTemplate()
makeSuperUser()
No private properties found
N/A

Methods

test_file_scene_valid_is_dict_first()

test_file_scene_valid_is_dict_first() : void

验证 FileScene 字典有数据时以字典为准(内置锚点被删项后不再放行)。

test_file_scene_builtin_fallback_when_dict_empty()

test_file_scene_builtin_fallback_when_dict_empty() : void

验证字典无数据时回落内置锚点保证系统可启动。

test_template_render_rejects_unregistered_type()

test_template_render_rejects_unregistered_type() : void

验证模板渲染未登记 type 返回 400、合法类型照常渲染。

test_template_render_key_auth_required_when_not_public()

test_template_render_key_auth_required_when_not_public() : void

验证未公开渲染时 key 鉴权:缺 key / 错 key → 403,正确 key → 200(安全默认)。

test_template_render_key_rotation_grace_then_revoke()

test_template_render_key_rotation_grace_then_revoke() : void

验证 key 轮换宽限期新旧并存、收回旧 key 后旧 key 立即失效。

test_companies_ids_returns_full_list_beyond_pagination_cap()

test_companies_ids_returns_full_list_beyond_pagination_cap() : void

验证公司全量 id 清单不受列表分页上限钳制。

test_template_types_display_name_sourced_from_dict()

test_template_types_display_name_sourced_from_dict() : void

验证模板展示名唯一化取自字典、未登记类型回落注册表声明名。

test_template_category_dict_matches_code_contract()

test_template_category_dict_matches_code_contract() : void

验证模板分类字典 value 集与 SysTemplate::CATEGORIES 常量一致。

test_super_role_anchor_write_protection()

test_super_role_anchor_write_protection() : void

验证超级角色锚点写保护(禁创建/改码/改锁定字段/删除)。

test_super_post_anchor_write_protection()

test_super_post_anchor_write_protection() : void

验证超级管理员岗位锚点写保护(禁创建/改码/改锁定字段/删除)。

makeDef()

makeDef(string  $key, string  $type, mixed  $default = null, string  $validation = '', string  $options = '', int  $isTabs) : \App\Models\SysConfigDefinition

创建测试配置定义(TEST 组,静态来源)

Parameters

string $key
string $type
mixed $default
string $validation
string $options
int $isTabs

Returns

\App\Models\SysConfigDefinition —

requireRedis()

requireRedis() : void

Redis 依赖探针:直连 Redis 的测试(限流/会话/验证码)在无 Redis 环境(如 CI) 跳过而非失败——其余用例不受影响。CI 可设 TEST_REQUIRE_REDIS=1 强制模式: Redis 不可达即失败而非跳过,安全回归套件不允许静默消失。

buildCacheRegistry()

buildCacheRegistry(array  $items) : void

建缓存注册表最小 schema(td_sys_cache)并灌入注册项。

测试跑 sqlite :memory:,生产迁移含 PostgreSQL 专属 DDL 跑不通(DataScopeServiceTest 同因自建 schema); 而 CacheManager::registry() 现已从数据库表读取——凡走注册表的测试(remember/get/key/失效推导) 必须在 setUp 先调用本方法,否则注册表为空、remember 未登记名会走「自动登记」路径。

Parameters

array $items

seedSceneDict()

seedSceneDict(array  $values) : void

scene 字典播种(仅给指定 value 集,模拟字典数据页增删)

Parameters

array $values

seedDict()

seedDict(string  $typeCode, array  $pairs) : void

指定 type_code 的字典播种(value => label)

Parameters

string $typeCode
array $pairs

makeRenderKeyTemplate()

makeRenderKeyTemplate() : \App\Models\SysTemplate

未公开渲染的 key 鉴权模板工厂(render_public=0,正文 'hi',无 vars)。

Returns

\App\Models\SysTemplate —

makeSuperUser()

makeSuperUser(string  $username) : \App\Models\SysUser

Parameters

string $username

Returns

\App\Models\SysUser —