\Tests\FeatureMaintainMenuUpdateTest

菜单更新/移动校验回归

被测对象:MaintainMenuService::update 的校验链 守护约定:① 不能自己/子级为父(循环)② 父级必须存在 ③ 子类型兼容 (页面/外链不可有子级)④ 类型变更不得与既有子级冲突 ⑤ 移动后层级不超 MAX_DEPTH=4 ⑥ 合法移动正常生效。

Summary

Methods
Properties
Constants
test_cannot_set_self_as_parent()
test_cannot_set_descendant_as_parent()
test_parent_must_exist()
test_page_cannot_host_child_page()
test_type_change_conflicts_with_existing_children()
test_move_beyond_max_depth_rejected()
test_valid_move_updates_parent()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
makeMenu()
$service
N/A

Properties

Methods

test_cannot_set_self_as_parent()

test_cannot_set_self_as_parent() : void

不能将自己设为父菜单

test_cannot_set_descendant_as_parent()

test_cannot_set_descendant_as_parent() : void

不能将子菜单设为父菜单(循环引用)

test_parent_must_exist()

test_parent_must_exist() : void

父菜单不存在

test_page_cannot_host_child_page()

test_page_cannot_host_child_page() : void

子类型兼容:页面/外链不可有子级(页面移到页面下被拒)

test_type_change_conflicts_with_existing_children()

test_type_change_conflicts_with_existing_children() : void

类型变更与子级冲突:目录下已有页面子级时不能改为页面

test_move_beyond_max_depth_rejected()

test_move_beyond_max_depth_rejected() : void

深度上限:移动后层级超 MAX_DEPTH=4 被拒(子树整体下移超深)

test_valid_move_updates_parent()

test_valid_move_updates_parent() : void

合法移动:目录移到另一目录下正常生效且清空导航类字段

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

makeMenu()

makeMenu(array  $attrs = []) : \App\Models\SysMenu

Parameters

array $attrs

Returns

\App\Models\SysMenu —