\Tests\FeatureConfigPostServiceTest

岗位数据范围回归

被测对象:getScopeRules / syncScopeRules / destroy 守护约定:① super 锚点岗位范围只读(403)② 显式组织须启用、显式部门须 末级且归属所选组织 ③ 覆盖式全量重建 ④ 删除级联清范围行与任职。

Summary

Methods
Properties
Constants
test_sync_scope_on_super_post_rejected()
test_sync_scope_rejects_stopped_company()
test_sync_scope_rejects_non_leaf_dept()
test_sync_scope_rejects_dept_not_in_company()
test_sync_scope_is_full_replace_and_readable_back()
test_destroy_super_post_rejected()
test_destroy_post_cascades_scope_and_memberships()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
makeCompany()
makePost()
$service
N/A

Properties

Methods

test_sync_scope_on_super_post_rejected()

test_sync_scope_on_super_post_rejected() : void

super 锚点岗位:范围只读(403 语义错误)——纵深防御,前端面板已只读

test_sync_scope_rejects_stopped_company()

test_sync_scope_rejects_stopped_company() : void

显式组织:停用组织拒绝勾选(公司停用即回收,与任职校验同规)

test_sync_scope_rejects_non_leaf_dept()

test_sync_scope_rejects_non_leaf_dept() : void

显式部门:仅末级(叶子)可勾——非末级部门拒绝

test_sync_scope_rejects_dept_not_in_company()

test_sync_scope_rejects_dept_not_in_company() : void

显式部门:部门不属于所选组织拒绝

test_sync_scope_is_full_replace_and_readable_back()

test_sync_scope_is_full_replace_and_readable_back() : void

覆盖式同步:先存组织模式再存部门模式 → 全量重建只剩后者;getScopeRules 回读一致

test_destroy_super_post_rejected()

test_destroy_super_post_rejected() : void

删除岗位:super 锚点拒绝删除

test_destroy_post_cascades_scope_and_memberships()

test_destroy_post_cascades_scope_and_memberships() : 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

makeCompany()

makeCompany(array  $attrs = []) : \App\Models\SysCompany

Parameters

array $attrs

Returns

\App\Models\SysCompany —

makePost()

makePost(array  $attrs = []) : \App\Models\SysPost

Parameters

array $attrs

Returns

\App\Models\SysPost —