\Tests\FeatureLogPasswordTest

密码修改台账

被测对象:WritePasswordLog(事件落库)+ UserConfigService::create/resetPassword(派发点)+ LogMyController::passwordIndex(本人台账查询) 守护约定:台账只含加盐哈希与元数据(绝无明文);新建=初始设置、重置=重置类型; 操作来源留管理员姓名;个人中心查询恒为本人行(含超管)。

Summary

Methods
Properties
Constants
test_listener_records_event()
test_create_records_initial_row()
test_reset_records_reset_row()
test_my_password_logs_own_only()
No public properties found
No constants found
requireRedis()
buildCacheRegistry()
setUp()
No protected properties found
N/A
actAs()
No private properties found
N/A

Methods

test_listener_records_event()

test_listener_records_event() : void

密码修改事件 → 台账行(仅哈希与元数据,绝无明文)

test_create_records_initial_row()

test_create_records_initial_row() : void

管理员新建用户 → 初始设置行(操作来源=管理员姓名,哈希与用户表同值)

test_reset_records_reset_row()

test_reset_records_reset_row() : void

管理员重置 → 重置行;与初始行构成完整台账(改一次记一次)

test_my_password_logs_own_only()

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

建台账表 + 最小 td_sys_user schema(含 token_key 类列)并注册被测路由

actAs()

actAs(string  $username, string  $realName, bool  $super) : \App\Models\SysUser

构造登录测试用户(库内行,供数据范围判定与操作者姓名)

Parameters

string $username
string $realName
bool $super

Returns

\App\Models\SysUser —