\Tests\FeatureMenuRecursionTest

菜单树/权限目录性能基线

被测对象:MaintainMenuService::collectDescendantIds / SysMenu::getLevel/getSubtreeDepth/isUnderContainer / UserConfigService::permissionCatalog 守护约定:后代收集一次查询内存 BFS;层级/深度/容器判定走全表快照;权限目录 parent_id 分组一次; 断言结构正确 + 查询次数上界,防回归逐节点查询。

Summary

Methods
Properties
Constants
test_collect_descendant_ids_uses_single_query()
test_menu_level_and_depth_use_snapshot()
test_is_under_container_walks_snapshot()
test_permission_catalog_groups_by_parent()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
seedTree()
No private properties found
N/A

Methods

test_collect_descendant_ids_uses_single_query()

test_collect_descendant_ids_uses_single_query() : void

验证后代收集为单次查询(内存 BFS),非逐节点查询。

test_menu_level_and_depth_use_snapshot()

test_menu_level_and_depth_use_snapshot() : void

验证层级/深度走全表快照(常数级查询)。

test_is_under_container_walks_snapshot()

test_is_under_container_walks_snapshot() : void

验证容器链判定走快照(常数级查询)。

test_permission_catalog_groups_by_parent()

test_permission_catalog_groups_by_parent() : void

验证权限目录按 parent_id 分组一次构建(非递归内全量扫描)。

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

setUp()

setUp() : void

seedTree()

seedTree() : \App\Models\SysMenu

建一棵 1(目录)→2(目录)→3(页面)、1→4(页面) 的树

Returns

\App\Models\SysMenu —